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 
11 
15 class Edit extends \Magento\Backend\Block\Widget\Form\Container
16 {
22  protected $coreRegistry;
23 
27  protected $groupRepository;
28 
32  protected $groupManagement;
33 
43  public function __construct(
44  \Magento\Backend\Block\Widget\Context $context,
45  \Magento\Framework\Registry $registry,
48  array $data = []
49  ) {
50  $this->coreRegistry = $registry;
51  $this->groupRepository = $groupRepository;
52  $this->groupManagement = $groupManagement;
53  parent::__construct($context, $data);
54  }
55 
61  protected function _construct()
62  {
63  parent::_construct();
64 
65  $this->_objectId = 'id';
66  $this->_controller = 'adminhtml_group';
67  $this->_blockGroup = 'Magento_Customer';
68 
69  $this->buttonList->update('save', 'label', __('Save Customer Group'));
70  $this->buttonList->update('delete', 'label', __('Delete Customer Group'));
71 
72  $groupId = $this->coreRegistry->registry(RegistryConstants::CURRENT_GROUP_ID);
73  if (!$groupId || $this->groupManagement->isReadonly($groupId)) {
74  $this->buttonList->remove('delete');
75  }
76  }
77 
83  public function getHeaderText()
84  {
85  $groupId = $this->coreRegistry->registry(RegistryConstants::CURRENT_GROUP_ID);
86  if ($groupId === null) {
87  return __('New Customer Group');
88  } else {
89  $group = $this->groupRepository->getById($groupId);
90  return __('Edit Customer Group "%1"', $this->escapeHtml($group->getCode()));
91  }
92  }
93 
99  public function getHeaderCssClass()
100  {
101  return 'icon-head head-customer-groups';
102  }
103 }
__construct(\Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, GroupRepositoryInterface $groupRepository, GroupManagementInterface $groupManagement, array $data=[])
Definition: Edit.php:43
$group
Definition: sections.phtml:16
__()
Definition: __.php:13