本文整理匯總了PHP中Varien_Data_Form::getHtml方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Data_Form::getHtml方法的具體用法?PHP Varien_Data_Form::getHtml怎麽用?PHP Varien_Data_Form::getHtml使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Data_Form
的用法示例。
在下文中一共展示了Varien_Data_Form::getHtml方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _toHtml
protected function _toHtml()
{
$_form = new Varien_Data_Form();
$_form->setElementRenderer($this->getLayout()->createBlock('adminhtml/widget_form_renderer_element'));
$_form->setFieldsetRenderer($this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset'));
$_form->setFieldsetElementRenderer($this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element'));
$_fieldset = $_form->addFieldset('types_data_fset', array('legend' => $this->__('Representation settings')));
$_fieldset->setFieldsetContainerId('awf_types_settings');
$type = Mage::getSingleton('awfeatured/representations_config')->getRepresentation($this->getData('type'));
foreach ($type->getOptions() as $key => $options) {
$_field = $_fieldset->addField($key, $options['input_type'], array('label' => $this->__($options['label']), 'name' => 'type_data[' . $key . ']'));
if ($_field) {
if (isset($options['default'])) {
$_field->setValue($options['default']);
}
if ($options['input_type'] == 'select' && isset($options['source_model'])) {
$_field->setValues(Mage::getModel($options['source_model'])->toOptionArray());
}
if (isset($options['required'])) {
$_field->setRequired($options['required']);
}
}
}
if ($this->getData('is_init')) {
$_data = Mage::getSingleton('adminhtml/session')->getData(AW_Featured_Helper_Data::FORM_DATA_KEY);
$_data = isset($_data['type_data']) ? $_data['type_data'] : null;
if ($_data) {
$_form->setValues($_data);
}
}
return $_form->getHtml();
}