Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Template.php
Go to the documentation of this file.
1 <?php
7 declare(strict_types=1);
8 
9 namespace Magento\Backend\Block;
10 
34 {
38  protected $_authorization;
39 
43  protected $mathRandom;
44 
48  protected $_backendSession;
49 
53  protected $formKey;
54 
58  protected $nameBuilder;
59 
64  public function __construct(\Magento\Backend\Block\Template\Context $context, array $data = [])
65  {
66  $this->_localeDate = $context->getLocaleDate();
67  $this->_authorization = $context->getAuthorization();
68  $this->mathRandom = $context->getMathRandom();
69  $this->_backendSession = $context->getBackendSession();
70  $this->formKey = $context->getFormKey();
71  $this->nameBuilder = $context->getNameBuilder();
72  parent::__construct($context, $data);
73  }
74 
80  public function getFormKey()
81  {
82  return $this->formKey->getFormKey();
83  }
84 
99  public function isOutputEnabled($moduleName = null)
100  {
101  if ($moduleName === null) {
102  $moduleName = $this->getModuleName();
103  }
104 
105  return !$this->_scopeConfig->isSetFlag(
106  'advanced/modules_disable_output/' . $moduleName,
107  \Magento\Store\Model\ScopeInterface::SCOPE_STORE
108  );
109  }
110 
116  public function getAuthorization()
117  {
118  return $this->_authorization;
119  }
120 
126  protected function _toHtml()
127  {
128  $this->_eventManager->dispatch('adminhtml_block_html_before', ['block' => $this]);
129  return parent::_toHtml();
130  }
131 
137  public function getToolbar()
138  {
139  return $this->getLayout()->getBlock('page.actions.toolbar');
140  }
141 }
isOutputEnabled($moduleName=null)
Definition: Template.php:99
__construct(\Magento\Backend\Block\Template\Context $context, array $data=[])
Definition: Template.php:64