src/module-elasticsuite-indices/Block/Adminhtml/IndexView/BackButton.php
<?php
/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
* versions in the future.
*
* @category Smile
* @package Smile\ElasticsuiteIndices
* @author Dmytro ANDROSHCHUK <dmand@smile.fr>
* @copyright 2020 Smile
* @license Open Software License ("OSL") v. 3.0
*/
namespace Smile\ElasticsuiteIndices\Block\Adminhtml\IndexView;
use Magento\Backend\Block\Widget\Container;
use Magento\Backend\Block\Widget\Context;
/**
* Adminhtml Back button.
*
* @category Smile
* @package Smile\ElasticsuiteIndices
* @author Dmytro ANDROSHCHUK <dmand@smile.fr>
*/
class BackButton extends Container
{
/**
* @param Context $context The current context.
* @param array $data Data.
*/
public function __construct(
Context $context,
array $data = []
) {
parent::__construct($context, $data);
$this->addButton(
'back',
$this->getButtonData()
);
}
/**
* Return button attributes array
*
* @return array
*/
public function getButtonData()
{
return [
'label' => __('Back'),
'on_click' => sprintf("location.href = '%s';", $this->getUrl('*/*/index')),
'class' => 'back',
];
}
}