Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 813dca5

Browse files
committed
[FEATURE] Change the store code in Swagger based on a param
1 parent 86eed24 commit 813dca5

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/***
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Swagger\Helper;
7+
8+
/**
9+
* Class Data
10+
* @package Magento\Swagger\Helper\Data
11+
*/
12+
class Data extends \Magento\Framework\App\Helper\AbstractHelper
13+
{
14+
15+
/**
16+
* @var \Magento\Framework\App\Request\Http
17+
*/
18+
protected $request;
19+
20+
/**
21+
* @param \Magento\Framework\App\Helper\Context $context
22+
* @param \Magento\Framework\App\Request\Http $request
23+
*/
24+
public function __construct(
25+
\Magento\Framework\App\Helper\Context $context,
26+
\Magento\Framework\App\Request\Http $request
27+
) {
28+
$this->request = $request;
29+
parent::__construct($context);
30+
}
31+
32+
/**
33+
* @return mixed|string
34+
*/
35+
public function getParamStore()
36+
{
37+
return ($this->request->getParam('store')) ? $this->request->getParam('store') : 'all';
38+
}
39+
}

app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
/** @var \Magento\Framework\View\Element\Template $block */
1616

17-
$schemaUrl = rtrim($block->getBaseUrl(), '/') . '/rest/all/schema?services=all';
17+
$schemaUrl = rtrim($block->getBaseUrl(), '/') . '/rest/' . $this->helper('Magento\Swagger\Helper\Data')->getParamStore() . '/schema?services=all';
1818
?>
1919

2020
<div id='header'>

0 commit comments

Comments
 (0)