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 
9 {
13  protected $_template = 'Magento_Backend::system/design/edit.phtml';
14 
20  protected $_coreRegistry = null;
21 
27  public function __construct(
28  \Magento\Backend\Block\Template\Context $context,
29  \Magento\Framework\Registry $registry,
30  array $data = []
31  ) {
32  $this->_coreRegistry = $registry;
33  parent::__construct($context, $data);
34  }
35 
39  protected function _construct()
40  {
41  parent::_construct();
42 
43  $this->setId('design_edit');
44  }
45 
49  protected function _prepareLayout()
50  {
51  $this->getToolbar()->addChild(
52  'back_button',
53  \Magento\Backend\Block\Widget\Button::class,
54  [
55  'label' => __('Back'),
56  'onclick' => 'setLocation(\'' . $this->getUrl('adminhtml/*/') . '\')',
57  'class' => 'back'
58  ]
59  );
60 
61  if ($this->getDesignChangeId()) {
62  $this->getToolbar()->addChild(
63  'delete_button',
64  \Magento\Backend\Block\Widget\Button::class,
65  [
66  'label' => __('Delete'),
67  'onclick' => 'deleteConfirm(\'' . __(
68  'Are you sure?'
69  ) . '\', \'' . $this->getDeleteUrl() . '\')',
70  'class' => 'delete'
71  ]
72  );
73  }
74 
75  $this->getToolbar()->addChild(
76  'save_button',
77  \Magento\Backend\Block\Widget\Button::class,
78  [
79  'label' => __('Save'),
80  'class' => 'save primary',
81  'data_attribute' => [
82  'mage-init' => ['button' => ['event' => 'save', 'target' => '#design-edit-form']],
83  ]
84  ]
85  );
86 
87  return parent::_prepareLayout();
88  }
89 
93  public function getDesignChangeId()
94  {
95  return $this->_coreRegistry->registry('design')->getId();
96  }
97 
101  public function getDeleteUrl()
102  {
103  return $this->getUrl('adminhtml/*/delete', ['_current' => true]);
104  }
105 
109  public function getSaveUrl()
110  {
111  return $this->getUrl('adminhtml/*/save', ['_current' => true]);
112  }
113 
117  public function getValidationUrl()
118  {
119  return $this->getUrl('adminhtml/*/validate', ['_current' => true]);
120  }
121 
125  public function getHeader()
126  {
127  if ($this->_coreRegistry->registry('design')->getId()) {
128  $header = __('Edit Design Change');
129  } else {
130  $header = __('New Store Design Change');
131  }
132  return $header;
133  }
134 }
if( $form)() ?>< script > require(['jquery' mage mage
Definition: save.phtml:15
__()
Definition: __.php:13
jquery extjs ext tree mage adminhtml form
Definition: tree.phtml:41
taxRateField this edit() this edit
Definition: edit.phtml:223
__construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, array $data=[])
Definition: Edit.php:27