Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NewAction.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
11 
12 class NewAction extends \Magento\Customer\Controller\Adminhtml\Group implements HttpGetActionInterface
13 {
19  protected function _initGroup()
20  {
21  $groupId = $this->getRequest()->getParam('id');
22  $this->_coreRegistry->register(RegistryConstants::CURRENT_GROUP_ID, $groupId);
23 
24  return $groupId;
25  }
26 
32  public function execute()
33  {
34  $groupId = $this->_initGroup();
35 
37  $resultPage = $this->resultPageFactory->create();
38  $resultPage->setActiveMenu('Magento_Customer::customer_group');
39  $resultPage->getConfig()->getTitle()->prepend(__('Customer Groups'));
40  $resultPage->addBreadcrumb(__('Customers'), __('Customers'));
41  $resultPage->addBreadcrumb(__('Customer Groups'), __('Customer Groups'), $this->getUrl('customer/group'));
42 
43  if ($groupId === null) {
44  $resultPage->addBreadcrumb(__('New Group'), __('New Customer Groups'));
45  $resultPage->getConfig()->getTitle()->prepend(__('New Customer Group'));
46  } else {
47  $resultPage->addBreadcrumb(__('Edit Group'), __('Edit Customer Groups'));
48  $resultPage->getConfig()->getTitle()->prepend(
49  $this->groupRepository->getById($groupId)->getCode()
50  );
51  }
52 
53  $resultPage->getLayout()->addBlock(\Magento\Customer\Block\Adminhtml\Group\Edit::class, 'group', 'content')
54  ->setEditMode((bool)$groupId);
55 
56  return $resultPage;
57  }
58 }
__()
Definition: __.php:13