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

Commit 28c0467

Browse files
committed
[TASK] Moved Helper Logic to custom Block Class
1 parent 046765c commit 28c0467

File tree

3 files changed

+32
-48
lines changed

3 files changed

+32
-48
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Swagger\Block;
7+
8+
use Magento\Framework\View\Element\Template;
9+
10+
/**
11+
* Class Index
12+
* @package Magento\Swagger\Block
13+
*/
14+
class Index extends Template
15+
{
16+
/**
17+
* @return mixed|string
18+
*/
19+
public function getParamStore()
20+
{
21+
return ($this->getRequest()->getParam('store')) ? $this->getRequest()->getParam('store') : 'all';
22+
}
23+
24+
/**
25+
* @return string
26+
*/
27+
public function getSchemaUrl()
28+
{
29+
return rtrim($this->getBaseUrl(), '/') . '/rest/' . $this->getParamStore() . '/schema?services=all';
30+
}
31+
}

app/code/Magento/Swagger/Helper/Data.php

Lines changed: 0 additions & 47 deletions
This file was deleted.

app/code/Magento/Swagger/view/frontend/layout/swagger_index_index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<referenceContainer name="page.wrapper" remove="true"/>
4242
<referenceBlock name="requirejs-config" remove="true"/>
4343
<referenceContainer name="root">
44-
<block name="swaggerUiContent" class="Magento\Framework\View\Element\Template" template="Magento_Swagger::swagger-ui/index.phtml"/>
44+
<block name="swaggerUiContent" class="Magento\Swagger\Block\Index" template="Magento_Swagger::swagger-ui/index.phtml"/>
4545
</referenceContainer>
4646
</body>
4747
</page>

0 commit comments

Comments
 (0)