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 
12 class Edit extends \Magento\Backend\Block\Widget\Tabs
13 {
19  protected $_coreRegistry = null;
20 
28  public function __construct(
29  \Magento\Backend\Block\Template\Context $context,
30  \Magento\Framework\Json\EncoderInterface $jsonEncoder,
31  \Magento\Backend\Model\Auth\Session $authSession,
32  \Magento\Framework\Registry $registry,
33  array $data = []
34  ) {
35  $this->_coreRegistry = $registry;
36  parent::__construct($context, $jsonEncoder, $authSession, $data);
37  }
38 
44  protected function _construct()
45  {
46  parent::_construct();
47  $this->setId('role_info_tabs');
48  $this->setDestElementId('role-edit-form');
49  $this->setTitle(__('Role Information'));
50  }
51 
55  protected function _prepareLayout()
56  {
57  $role = $this->_coreRegistry->registry('current_role');
58 
59  $this->addTab(
60  'info',
61  $this->getLayout()->createBlock(\Magento\User\Block\Role\Tab\Info::class)->setRole($role)->setActive(true)
62  );
63 
64  if ($role->getId()) {
65  $this->addTab(
66  'roles',
67  [
68  'label' => __('Role Users'),
69  'title' => __('Role Users'),
70  'content' => $this->getLayout()->createBlock(
71  \Magento\User\Block\Role\Tab\Users::class,
72  'role.users.grid'
73  )->toHtml()
74  ]
75  );
76  }
77 
78  return parent::_prepareLayout();
79  }
80 }
__()
Definition: __.php:13
__construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Backend\Model\Auth\Session $authSession, \Magento\Framework\Registry $registry, array $data=[])
Definition: Edit.php:28