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

Public Member Functions

 __construct (\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Data\FormFactory $formFactory, \Magento\SalesRule\Model\RuleFactory $ruleFactory, array $data=[])
 
 getTabClass ()
 
 getTabUrl ()
 
 isAjaxLoaded ()
 
 getTabLabel ()
 
 getTabTitle ()
 
 canShowTab ()
 
 isHidden ()
 
- Public Member Functions inherited from Generic
 __construct (\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Data\FormFactory $formFactory, array $data=[])
 
- Public Member Functions inherited from Form
 __construct (\Magento\Backend\Block\Template\Context $context, array $data=[])
 
 getForm ()
 
 getFormHtml ()
 
 setForm (\Magento\Framework\Data\Form $form)
 
- Public Member Functions inherited from Widget
 getId ()
 
 getSuffixId ($suffix)
 
 getHtmlId ()
 
 getCurrentUrl ($params=[])
 
 getButtonHtml ($label, $onclick, $class='', $buttonId=null, $dataAttr=[])
 
- 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 ()
 
- Public Member Functions inherited from TabInterface
 toHtml ()
 

Protected Member Functions

 _createStoreSpecificFieldset ($form, $labels)
 
- Protected Member Functions inherited from Form
 _construct ()
 
 _prepareLayout ()
 
 _prepareForm ()
 
 _beforeToHtml ()
 
 _initFormValues ()
 
 _setFieldset ($attributes, $fieldset, $exclude=[])
 
 _isAttributeVisible (\Magento\Eav\Model\Entity\Attribute $attribute)
 
 _applyTypeSpecificConfig ($inputType, $element, \Magento\Eav\Model\Entity\Attribute $attribute)
 
 _addElementTypes (\Magento\Framework\Data\Form\AbstractForm $baseElement)
 
 _getAdditionalElementTypes ()
 
 _getAdditionalElementHtml ($element)
 
- Protected Member Functions inherited from Widget
 _addBreadcrumb ($label, $title=null, $link=null)
 
- 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

 $_nameInLayout = 'store_view_labels'
 
- Protected Attributes inherited from Generic
 $_formFactory
 
 $_coreRegistry
 
- Protected Attributes inherited from Form
 $_form
 
 $_template = 'Magento_Backend::widget/form.phtml'
 
- 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

Definition at line 8 of file Labels.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Backend\Block\Template\Context  $context,
\Magento\Framework\Registry  $registry,
\Magento\Framework\Data\FormFactory  $formFactory,
\Magento\SalesRule\Model\RuleFactory  $ruleFactory,
array  $data = [] 
)

Initialize dependencies.

Parameters
\Magento\Backend\Block\Template\Context$context
\Magento\Framework\Registry$registry
\Magento\Framework\Data\FormFactory$formFactory
\Magento\SalesRule\Model\RuleFactory$ruleFactory
array$data

Definition at line 25 of file Labels.php.

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

Member Function Documentation

◆ _createStoreSpecificFieldset()

_createStoreSpecificFieldset (   $form,
  $labels 
)
protected

Create store specific fieldset

Parameters
\Magento\Framework\Data\Form$form
array$labels
Returns
\Magento\Framework\Data\Form\Element\Fieldset

Definition at line 145 of file Labels.php.

146  {
147  $fieldset = $form->addFieldset(
148  'store_labels_fieldset',
149  ['legend' => __('Store View Specific Labels'), 'class' => 'store-scope']
150  );
151  $renderer = $this->getLayout()->createBlock(
152  \Magento\Backend\Block\Store\Switcher\Form\Renderer\Fieldset::class
153  );
154  $fieldset->setRenderer($renderer);
155 
156  foreach ($this->_storeManager->getWebsites() as $website) {
157  $fieldset->addField(
158  "w_{$website->getId()}_label",
159  'note',
160  ['label' => $website->getName(), 'fieldset_html_class' => 'website']
161  );
162  foreach ($website->getGroups() as $group) {
163  $stores = $group->getStores();
164  if (count($stores) == 0) {
165  continue;
166  }
167  $fieldset->addField(
168  "sg_{$group->getId()}_label",
169  'note',
170  ['label' => $group->getName(), 'fieldset_html_class' => 'store-group']
171  );
172  foreach ($stores as $store) {
173  $fieldset->addField(
174  "s_{$store->getId()}",
175  'text',
176  [
177  'name' => 'store_labels[' . $store->getId() . ']',
178  'title' => $store->getName(),
179  'label' => $store->getName(),
180  'required' => false,
181  'value' => isset($labels[$store->getId()]) ? $labels[$store->getId()] : '',
182  'fieldset_html_class' => 'store',
183  'data-form-part' => 'sales_rule_form'
184  ]
185  );
186  }
187  }
188  }
189  return $fieldset;
190  }
$group
Definition: sections.phtml:16
__()
Definition: __.php:13

◆ canShowTab()

canShowTab ( )

{Can show tab in tabs

Returns
boolean
} @codeCoverageIgnore

Implements TabInterface.

Definition at line 90 of file Labels.php.

91  {
92  return true;
93  }

◆ getTabClass()

getTabClass ( )

{Tab class getter

Returns
string
} @codeCoverageIgnore

Implements TabInterface.

Definition at line 45 of file Labels.php.

46  {
47  return null;
48  }

◆ getTabLabel()

getTabLabel ( )

{Return Tab label

Returns
string
} @codeCoverageIgnore

Implements TabInterface.

Definition at line 72 of file Labels.php.

73  {
74  return __('Labels');
75  }
__()
Definition: __.php:13

◆ getTabTitle()

getTabTitle ( )

{Return Tab title

Returns
string
} @codeCoverageIgnore

Implements TabInterface.

Definition at line 81 of file Labels.php.

82  {
83  return __('Labels');
84  }
__()
Definition: __.php:13

◆ getTabUrl()

getTabUrl ( )

{Return URL link to Tab content

Returns
string
} @codeCoverageIgnore

Implements TabInterface.

Definition at line 54 of file Labels.php.

55  {
56  return null;
57  }

◆ isAjaxLoaded()

isAjaxLoaded ( )

{Tab should be loaded trough Ajax call

Returns
bool
} @codeCoverageIgnore

Implements TabInterface.

Definition at line 63 of file Labels.php.

64  {
65  return false;
66  }

◆ isHidden()

isHidden ( )

{Tab is hidden

Returns
boolean
} @codeCoverageIgnore

Implements TabInterface.

Definition at line 99 of file Labels.php.

100  {
101  return false;
102  }

Field Documentation

◆ $_nameInLayout

$_nameInLayout = 'store_view_labels'
protected

Definition at line 39 of file Labels.php.


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