本文整理匯總了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;
}