Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Buttons Class Reference
Inheritance diagram for Buttons:
Template Template AbstractBlock DataObject BlockInterface

Public Member Functions

 __construct (\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, array $data=[])
 
 getBackButtonHtml ()
 
 getResetButtonHtml ()
 
 getSaveButtonHtml ()
 
 getDeleteButtonHtml ()
 
 getUser ()
 
- Public Member Functions inherited from Template
 __construct (\Magento\Backend\Block\Template\Context $context, array $data=[])
 
 getFormKey ()
 
 isOutputEnabled ($moduleName=null)
 
 getAuthorization ()
 
 getToolbar ()
 
- Public Member Functions inherited from Template
 __construct (Template\Context $context, array $data=[])
 
 setTemplateContext ($templateContext)
 
 getTemplate ()
 
 setTemplate ($template)
 
 getTemplateFile ($template=null)
 
 getArea ()
 
 assign ($key, $value=null)
 
 fetchView ($fileName)
 
 getBaseUrl ()
 
 getObjectData (\Magento\Framework\DataObject $object, $key)
 
 getCacheKeyInfo ()
 
- Public Member Functions inherited from AbstractBlock
 __construct (\Magento\Framework\View\Element\Context $context, array $data=[])
 
 getJsLayout ()
 
 getRequest ()
 
 getParentBlock ()
 
 setLayout (\Magento\Framework\View\LayoutInterface $layout)
 
 getLayout ()
 
 setNameInLayout ($name)
 
 getChildNames ()
 
 setAttribute ($name, $value=null)
 
 setChild ($alias, $block)
 
 addChild ($alias, $block, $data=[])
 
 unsetChild ($alias)
 
 unsetCallChild ($alias, $callback, $result, $params)
 
 unsetChildren ()
 
 getChildBlock ($alias)
 
 getChildHtml ($alias='', $useCache=true)
 
 getChildChildHtml ($alias, $childChildAlias='', $useCache=true)
 
 getBlockHtml ($name)
 
 insert ($element, $siblingName=0, $after=true, $alias='')
 
 append ($element, $alias='')
 
 getGroupChildNames ($groupName)
 
 getChildData ($alias, $key='')
 
 getUiId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getJsId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getUrl ($route='', $params=[])
 
 getViewFileUrl ($fileId, array $params=[])
 
 formatDate ( $date=null, $format=\IntlDateFormatter::SHORT, $showTime=false, $timezone=null)
 
 formatTime ( $time=null, $format=\IntlDateFormatter::SHORT, $showDate=false)
 
 getModuleName ()
 
 escapeHtml ($data, $allowedTags=null)
 
 escapeJs ($string)
 
 escapeHtmlAttr ($string, $escapeSingleQuote=true)
 
 escapeCss ($string)
 
 stripTags ($data, $allowableTags=null, $allowHtmlEntities=false)
 
 escapeUrl ($string)
 
 escapeXssInUrl ($data)
 
 escapeQuote ($data, $addSlashes=false)
 
 escapeJsQuote ($data, $quote='\'')
 
 getNameInLayout ()
 
 getCacheKeyInfo ()
 
 getCacheKey ()
 
 getVar ($name, $module=null)
 
 isScopePrivate ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 
- Public Member Functions inherited from BlockInterface
 toHtml ()
 

Protected Member Functions

 _prepareLayout ()
 
- Protected Member Functions inherited from Template
 _toHtml ()
 
- Protected Member Functions inherited from Template
 _construct ()
 
 _toHtml ()
 
 getRootDirectory ()
 
 getMediaDirectory ()
 
- Protected Member Functions inherited from AbstractBlock
 _construct ()
 
 _prepareLayout ()
 
 _beforeToHtml ()
 
 _afterToHtml ($html)
 
 _toHtml ()
 
 _getNotFoundUrl ($route='', $params=['_direct'=> 'core/index/notFound'])
 
 getCacheTags ()
 
 getCacheLifetime ()
 
 _loadCache ()
 
 _saveCache ($data)
 
 _getSidPlaceholder ($cacheKey=null)
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $_coreRegistry = null
 
- Protected Attributes inherited from Template
 $_authorization
 
 $mathRandom
 
 $_backendSession
 
 $formKey
 
 $nameBuilder
 
- Protected Attributes inherited from Template
 $_viewVars = []
 
 $_baseUrl
 
 $_jsUrl
 
 $_allowSymlinks
 
 $_filesystem
 
 $_template
 
 $templateEnginePool
 
 $_storeManager
 
 $_appState
 
 $directory
 
 $templateContext
 
 $pageConfig
 
 $resolver
 
 $validator
 
- Protected Attributes inherited from AbstractBlock
 $_design
 
 $_session
 
 $_sidResolver
 
 $_nameInLayout
 
 $_layout
 
 $jsLayout = []
 
 $_request
 
 $_urlBuilder
 
 $_eventManager
 
 $_frontController
 
 $_assetRepo
 
 $_viewConfig
 
 $_cacheState
 
 $_logger
 
 $_escaper
 
 $filterManager
 
 $_localeDate
 
 $inlineTranslation
 
 $_isScopePrivate = false
 
 $_scopeConfig
 
 $_cache
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractBlock
static extractModuleName ($className)
 
- Data Fields inherited from Template
const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink'
 
- Data Fields inherited from AbstractBlock
const CACHE_GROUP = \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER
 
const CACHE_KEY_PREFIX = 'BLOCK_'
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

@api

Since
100.0.2

Definition at line 12 of file Buttons.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Backend\Block\Template\Context  $context,
\Magento\Framework\Registry  $registry,
array  $data = [] 
)
Parameters
\Magento\Backend\Block\Template\Context$context
\Magento\Framework\Registry$registry
array$data

Definition at line 26 of file Buttons.php.

30  {
31  $this->_coreRegistry = $registry;
32  parent::__construct($context, $data);
33  }

Member Function Documentation

◆ _prepareLayout()

_prepareLayout ( )
protected
Returns
$this

Definition at line 38 of file Buttons.php.

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  }
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
taxRateField this edit() this edit
Definition: edit.phtml:223

◆ getBackButtonHtml()

getBackButtonHtml ( )
Returns
string

Definition at line 90 of file Buttons.php.

91  {
92  return $this->getChildHtml('backButton');
93  }

◆ getDeleteButtonHtml()

getDeleteButtonHtml ( )
Returns
string|void

Definition at line 114 of file Buttons.php.

115  {
116  if (intval($this->getRequest()->getParam('rid')) == 0) {
117  return;
118  }
119  return $this->getChildHtml('deleteButton');
120  }

◆ getResetButtonHtml()

getResetButtonHtml ( )
Returns
string

Definition at line 98 of file Buttons.php.

99  {
100  return $this->getChildHtml('resetButton');
101  }

◆ getSaveButtonHtml()

getSaveButtonHtml ( )
Returns
string

Definition at line 106 of file Buttons.php.

107  {
108  return $this->getChildHtml('saveButton');
109  }

◆ getUser()

getUser ( )
Returns
mixed

Definition at line 125 of file Buttons.php.

126  {
127  return $this->_coreRegistry->registry('user_data');
128  }

Field Documentation

◆ $_coreRegistry

$_coreRegistry = null
protected

Definition at line 19 of file Buttons.php.


The documentation for this class was generated from the following file: