Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Edit.php
Go to the documentation of this file.
1 <?php
7 
13 class Edit extends \Magento\Backend\Block\Widget\Form\Container
14 {
20  protected $_coreRegistry = null;
21 
27  public function __construct(
28  \Magento\Backend\Block\Widget\Context $context,
29  \Magento\Framework\Registry $registry,
30  array $data = []
31  ) {
32  $this->_coreRegistry = $registry;
33  parent::__construct($context, $data);
34  }
35 
41  protected function _construct()
42  {
43  $this->_objectId = 'sitemap_id';
44  $this->_controller = 'adminhtml';
45  $this->_blockGroup = 'Magento_Sitemap';
46 
47  parent::_construct();
48 
49  $this->buttonList->add(
50  'generate',
51  [
52  'label' => __('Save & Generate'),
53  'data_attribute' => [
54  'mage-init' => [
55  'button' => [
56  'event' => 'save',
57  'target' => '#edit_form',
58  'eventData' => ['action' => ['args' => ['generate' => '1']]],
59  ],
60  ],
61  ],
62  'class' => 'add'
63  ]
64  );
65  }
66 
72  public function getHeaderText()
73  {
74  if ($this->_coreRegistry->registry('sitemap_sitemap')->getId()) {
75  return __('Edit Sitemap');
76  } else {
77  return __('New Sitemap');
78  }
79  }
80 }
__()
Definition: __.php:13
__construct(\Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, array $data=[])
Definition: Edit.php:27