Skip to content

Commit 6195cfd

Browse files
committed
Merge pull request #225 from magento-south/MAGETWO-42138
[SOUTH + FIREDRAKES] CMS Page Update
2 parents f78935d + e4951c2 commit 6195cfd

File tree

70 files changed

+1794
-1846
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1794
-1846
lines changed

app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php

Lines changed: 0 additions & 84 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cms\Block\Adminhtml\Block\Edit;
7+
8+
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
9+
10+
/**
11+
* Class BackButton
12+
*/
13+
class BackButton extends GenericButton implements ButtonProviderInterface
14+
{
15+
/**
16+
* @return array
17+
*/
18+
public function getButtonData()
19+
{
20+
return [
21+
'label' => __('Back'),
22+
'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()),
23+
'class' => 'back',
24+
'sort_order' => 10
25+
];
26+
}
27+
28+
/**
29+
* Get URL for back (reset) button
30+
*
31+
* @return string
32+
*/
33+
public function getBackUrl()
34+
{
35+
return $this->getUrl('*/*/');
36+
}
37+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cms\Block\Adminhtml\Block\Edit;
7+
8+
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
9+
10+
/**
11+
* Class DeleteButton
12+
*/
13+
class DeleteButton extends GenericButton implements ButtonProviderInterface
14+
{
15+
16+
/**
17+
* @return array
18+
*/
19+
public function getButtonData()
20+
{
21+
$data = [];
22+
if ($this->getPageId()) {
23+
$data = [
24+
'label' => __('Delete Block'),
25+
'class' => 'delete',
26+
'on_click' => 'deleteConfirm(\'' . __(
27+
'Are you sure you want to do this?'
28+
) . '\', \'' . $this->getDeleteUrl() . '\')',
29+
'sort_order' => 20,
30+
];
31+
}
32+
return $data;
33+
}
34+
35+
/**
36+
* @return string
37+
*/
38+
public function getDeleteUrl()
39+
{
40+
return $this->getUrl('*/*/delete', ['block_id' => $this->getPageId()]);
41+
}
42+
}

app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php

Lines changed: 0 additions & 159 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cms\Block\Adminhtml\Block\Edit;
7+
8+
use Magento\Cms\Controller\RegistryConstants;
9+
10+
/**
11+
* Class GenericButton
12+
*/
13+
class GenericButton
14+
{
15+
/**
16+
* Url Builder
17+
*
18+
* @var \Magento\Framework\UrlInterface
19+
*/
20+
protected $urlBuilder;
21+
22+
/**
23+
* Registry
24+
*
25+
* @var \Magento\Framework\Registry
26+
*/
27+
protected $registry;
28+
29+
/**
30+
* Constructor
31+
*
32+
* @param \Magento\Backend\Block\Widget\Context $context
33+
* @param \Magento\Framework\Registry $registry
34+
*/
35+
public function __construct(
36+
\Magento\Backend\Block\Widget\Context $context,
37+
\Magento\Framework\Registry $registry
38+
) {
39+
$this->urlBuilder = $context->getUrlBuilder();
40+
$this->registry = $registry;
41+
}
42+
43+
/**
44+
* Return the cms page Id.
45+
*
46+
* @return int|null
47+
*/
48+
public function getPageId()
49+
{
50+
$cmsBlock = $this->registry->registry(RegistryConstants::CMS_BLOCK);
51+
return $cmsBlock ? $cmsBlock->getId() : null;
52+
}
53+
54+
/**
55+
* Generate url by route and parameters
56+
*
57+
* @param string $route
58+
* @param array $params
59+
* @return string
60+
*/
61+
public function getUrl($route = '', $params = [])
62+
{
63+
return $this->urlBuilder->getUrl($route, $params);
64+
}
65+
}

0 commit comments

Comments
 (0)