本文整理汇总了PHP中Magento\Backend\Block\Widget\Form\Generic::_beforeToHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Generic::_beforeToHtml方法的具体用法?PHP Generic::_beforeToHtml怎么用?PHP Generic::_beforeToHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Block\Widget\Form\Generic
的用法示例。
在下文中一共展示了Generic::_beforeToHtml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _beforeToHtml
/**
* This method is called before rendering HTML
*
* @return \Magento\Backend\Block\Widget\Form
*/
protected function _beforeToHtml()
{
$result = parent::_beforeToHtml();
/** @var \Magento\Framework\Data\Form\Element\Fieldset $fieldset */
$fieldset = $this->getForm()->getElement('base_fieldset');
if (is_object($fieldset) && $fieldset instanceof \Magento\Framework\Data\Form\Element\Fieldset) {
// apply field visibility
foreach ($fieldset->getElements() as $field) {
if (!$this->getFieldVisibility($field->getId())) {
$fieldset->removeField($field->getId());
}
}
// apply field options
foreach ($this->_fieldOptions as $fieldId => $fieldOptions) {
$field = $fieldset->getElements()->searchById($fieldId);
/** @var \Magento\Framework\DataObject $field */
if ($field) {
foreach ($fieldOptions as $k => $v) {
$field->setDataUsingMethod($k, $v);
}
}
}
}
return $result;
}
示例2: _beforeToHtml
/**
* @return $this
*/
public function _beforeToHtml()
{
$this->_initForm();
return parent::_beforeToHtml();
}
示例3: _beforeToHtml
/**
* @return \Magento\Backend\Block\Widget\Form|\Magento\Framework\View\Element\AbstractBlock
*/
protected function _beforeToHtml()
{
$this->initForm();
return parent::_beforeToHtml();
}
示例4: _beforeToHtml
/**
* This method is called before rendering HTML
*
* @return $this
*/
protected function _beforeToHtml()
{
parent::_beforeToHtml();
$attributeObject = $this->getAttributeObject();
if ($attributeObject->getId()) {
$form = $this->getForm();
foreach ($this->_attributeConfig->getLockedFields($attributeObject) as $field) {
if ($element = $form->getElement($field)) {
$element->setDisabled(1);
$element->setReadonly(1);
}
}
}
return $this;
}