Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/develop' into BUGS
Browse files Browse the repository at this point in the history
  • Loading branch information
slavvka committed Dec 9, 2015
2 parents 9be4939 + 6195cfd commit f4d3e04
Show file tree
Hide file tree
Showing 70 changed files with 1,794 additions and 1,846 deletions.
84 changes: 0 additions & 84 deletions app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php

This file was deleted.

37 changes: 37 additions & 0 deletions app/code/Magento/Cms/Block/Adminhtml/Block/Edit/BackButton.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Cms\Block\Adminhtml\Block\Edit;

use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;

/**
* Class BackButton
*/
class BackButton extends GenericButton implements ButtonProviderInterface
{
/**
* @return array
*/
public function getButtonData()
{
return [
'label' => __('Back'),
'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()),
'class' => 'back',
'sort_order' => 10
];
}

/**
* Get URL for back (reset) button
*
* @return string
*/
public function getBackUrl()
{
return $this->getUrl('*/*/');
}
}
42 changes: 42 additions & 0 deletions app/code/Magento/Cms/Block/Adminhtml/Block/Edit/DeleteButton.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Cms\Block\Adminhtml\Block\Edit;

use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;

/**
* Class DeleteButton
*/
class DeleteButton extends GenericButton implements ButtonProviderInterface
{

/**
* @return array
*/
public function getButtonData()
{
$data = [];
if ($this->getPageId()) {
$data = [
'label' => __('Delete Block'),
'class' => 'delete',
'on_click' => 'deleteConfirm(\'' . __(
'Are you sure you want to do this?'
) . '\', \'' . $this->getDeleteUrl() . '\')',
'sort_order' => 20,
];
}
return $data;
}

/**
* @return string
*/
public function getDeleteUrl()
{
return $this->getUrl('*/*/delete', ['block_id' => $this->getPageId()]);
}
}
159 changes: 0 additions & 159 deletions app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php

This file was deleted.

65 changes: 65 additions & 0 deletions app/code/Magento/Cms/Block/Adminhtml/Block/Edit/GenericButton.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Cms\Block\Adminhtml\Block\Edit;

use Magento\Cms\Controller\RegistryConstants;

/**
* Class GenericButton
*/
class GenericButton
{
/**
* Url Builder
*
* @var \Magento\Framework\UrlInterface
*/
protected $urlBuilder;

/**
* Registry
*
* @var \Magento\Framework\Registry
*/
protected $registry;

/**
* Constructor
*
* @param \Magento\Backend\Block\Widget\Context $context
* @param \Magento\Framework\Registry $registry
*/
public function __construct(
\Magento\Backend\Block\Widget\Context $context,
\Magento\Framework\Registry $registry
) {
$this->urlBuilder = $context->getUrlBuilder();
$this->registry = $registry;
}

/**
* Return the cms page Id.
*
* @return int|null
*/
public function getPageId()
{
$cmsBlock = $this->registry->registry(RegistryConstants::CMS_BLOCK);
return $cmsBlock ? $cmsBlock->getId() : null;
}

/**
* Generate url by route and parameters
*
* @param string $route
* @param array $params
* @return string
*/
public function getUrl($route = '', $params = [])
{
return $this->urlBuilder->getUrl($route, $params);
}
}
Loading

0 comments on commit f4d3e04

Please sign in to comment.