Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Buttons.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\User\Block;
7 
13 {
19  protected $_coreRegistry = null;
20 
26  public function __construct(
27  \Magento\Backend\Block\Template\Context $context,
28  \Magento\Framework\Registry $registry,
29  array $data = []
30  ) {
31  $this->_coreRegistry = $registry;
32  parent::__construct($context, $data);
33  }
34 
38  protected function _prepareLayout()
39  {
40  $this->getToolbar()->addChild(
41  'backButton',
42  \Magento\Backend\Block\Widget\Button::class,
43  [
44  'label' => __('Back'),
45  'onclick' => 'window.location.href=\'' . $this->getUrl('*/*/') . '\'',
46  'class' => 'back'
47  ]
48  );
49 
50  $this->getToolbar()->addChild(
51  'resetButton',
52  \Magento\Backend\Block\Widget\Button::class,
53  ['label' => __('Reset'), 'onclick' => 'window.location.reload()', 'class' => 'reset']
54  );
55 
56  if (intval($this->getRequest()->getParam('rid'))) {
57  $this->getToolbar()->addChild(
58  'deleteButton',
59  \Magento\Backend\Block\Widget\Button::class,
60  [
61  'label' => __('Delete Role'),
62  'onclick' => 'deleteConfirm(\'' . __(
63  'Are you sure you want to do this?'
64  ) . '\', \'' . $this->getUrl(
65  '*/*/delete',
66  ['rid' => $this->getRequest()->getParam('rid')]
67  ) . '\')',
68  'class' => 'delete'
69  ]
70  );
71  }
72 
73  $this->getToolbar()->addChild(
74  'saveButton',
75  \Magento\Backend\Block\Widget\Button::class,
76  [
77  'label' => __('Save Role'),
78  'class' => 'save primary save-role',
79  'data_attribute' => [
80  'mage-init' => ['button' => ['event' => 'save', 'target' => '#role-edit-form']],
81  ]
82  ]
83  );
84  return parent::_prepareLayout();
85  }
86 
90  public function getBackButtonHtml()
91  {
92  return $this->getChildHtml('backButton');
93  }
94 
98  public function getResetButtonHtml()
99  {
100  return $this->getChildHtml('resetButton');
101  }
102 
106  public function getSaveButtonHtml()
107  {
108  return $this->getChildHtml('saveButton');
109  }
110 
114  public function getDeleteButtonHtml()
115  {
116  if (intval($this->getRequest()->getParam('rid')) == 0) {
117  return;
118  }
119  return $this->getChildHtml('deleteButton');
120  }
121 
125  public function getUser()
126  {
127  return $this->_coreRegistry->registry('user_data');
128  }
129 }
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
__construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, array $data=[])
Definition: Buttons.php:26
taxRateField this edit() this edit
Definition: edit.phtml:223