本文整理汇总了PHP中Varien_Data_Form::getFieldsetRenderer方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form::getFieldsetRenderer方法的具体用法?PHP Varien_Data_Form::getFieldsetRenderer怎么用?PHP Varien_Data_Form::getFieldsetRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form
的用法示例。
在下文中一共展示了Varien_Data_Form::getFieldsetRenderer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareForm
/**
* Prepare form elements for tab
*
* @return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$model = $this->_getItemModel();
$typeId = $model->getTypeId();
$extensions = $model->getAllowedExtensions();
$bannerHtml = $bannerHtmlFile = $bannerHtmlCustom = '';
/**
* Checking if user have permissions to save information
*/
if ($this->_getAclHelper()->isActionAllowed($this->_aclSection . '/save')) {
$isElementDisabled = false;
} else {
$isElementDisabled = true;
}
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('banner_main_');
$form->getFieldsetRenderer()->setTemplate('lanot/easybanner/widget/form/renderer/fieldset.phtml');
//prepare fieldsets
$fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->_getHelper()->__('Banner Item Info')));
$fileFieldset = $form->addFieldset('file_fieldset', array('legend' => $this->_getHelper()->__('Banner File Info'), 'fieldset_container_id' => 'form_edit_container_file_fieldset', 'fieldset_container_class' => $typeId != Lanot_EasyBanner_Model_Banner::TYPE_ID_FILE ? 'no-display' : ''));
$customFieldset = $form->addFieldset('custom_fieldset', array('legend' => $this->_getHelper()->__('Banner Custom Code Info'), 'fieldset_container_id' => 'form_edit_container_custom_fieldset', 'fieldset_container_class' => $typeId != Lanot_EasyBanner_Model_Banner::TYPE_ID_CUSTOM ? 'no-display' : ''));
//apply additional renderers
$this->_addElementTypes($fieldset);
$this->_addElementTypes($fileFieldset);
$this->_addElementTypes($customFieldset);
if ($model->getId()) {
$fieldset->addField('banner_id', 'hidden', array('name' => 'id'));
}
//prepare banner HTML
if ($model->getType()) {
$bannerHtml = $this->_getHelper()->getBannerRenderer($model->getType())->disableClick()->setBanner($model)->render();
if (!empty($bannerHtml)) {
$style = 'width: 100%; overflow: hidden; margin: 15px 0px 0px 0px;';
$bannerHtml = "<div style='{$style}'>{$bannerHtml}</div>";
}
}
if ($typeId === Lanot_EasyBanner_Model_Banner::TYPE_ID_CUSTOM) {
$bannerHtmlCustom = $bannerHtml;
} else {
$bannerHtmlFile = $bannerHtml;
}
//general information
$fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => $this->_getHelper()->__('Is Active'), 'required' => true, 'options' => $model->getAvailableStatuses(), 'style' => 'width: 200px', 'disabled' => $isElementDisabled));
$fieldset->addField('type_id', 'select', array('name' => 'type_id', 'label' => $this->_getHelper()->__('Banner Type'), 'required' => true, 'options' => $model->getAvailableTypes(), 'style' => 'width: 200px', 'disabled' => $isElementDisabled, 'value' => $typeId, 'onchange' => 'changeBannerTypeId(this.value)'));
$fieldset->addField('title', 'text', array('name' => 'title', 'label' => $this->_getHelper()->__('Title'), 'required' => true, 'disabled' => $isElementDisabled));
$fieldset->addField('description', 'textarea', array('name' => 'description', 'label' => $this->_getHelper()->__('Description'), 'title' => $this->_getHelper()->__('Description'), 'disabled' => $isElementDisabled, 'style' => 'height: 60px'));
//file information
$fileFieldset->addField('url', 'text', array('name' => 'url', 'label' => $this->_getHelper()->__('Url'), 'disabled' => $isElementDisabled));
$fileFieldset->addField('width', 'text', array('name' => 'width', 'label' => $this->_getHelper()->__('Banner Width (px)'), 'disabled' => $isElementDisabled, 'style' => 'width: 50px'));
$fileFieldset->addField('height', 'text', array('name' => 'height', 'label' => $this->_getHelper()->__('Banner Height (px)'), 'disabled' => $isElementDisabled, 'style' => 'width: 50px'));
$fileFieldset->addField('path', 'banner', array('name' => 'banner_file', 'label' => $this->_getHelper()->__('File'), 'comment' => $this->_getHelper()->__('Allowed extensions: %s', implode(',', $extensions)), 'disabled' => $isElementDisabled, 'style' => 'width: 200px;'))->setBannerHtml($bannerHtmlFile);
//custom code information
$customFieldset->addField('code', 'textarea', array('name' => 'code', 'label' => $this->_getHelper()->__('Custom Code'), 'disabled' => $isElementDisabled))->setAfterElementHtml($bannerHtmlCustom);
Mage::dispatchEvent('adminhtml_easybanner_banner_edit_tab_main_prepare_form', array('form' => $form));
$form->setValues($model->getData());
$this->setForm($form);
return parent::_prepareForm();
}
示例2: __construct
/**
* Enter description here...
*
* @param array $attributes
*/
public function __construct($attributes = array())
{
parent::__construct($attributes);
$this->_renderer = Varien_Data_Form::getFieldsetRenderer();
$this->setType('fieldset');
if (isset($attributes['advancedSection'])) {
$this->_labelAdvanceSection = $attributes['advancedSection'];
} else {
$this->_labelAdvanceSection = Mage::helper('Mage_Core_Helper_Data')->__('Additional Settings');
}
}
示例3: _beforeToHtml
protected function _beforeToHtml()
{
parent::_beforeToHtml();
if (!Mage::registry('url_store')) {
$this->_unregUrlStore = true;
Mage::register('url_store', Mage::app()->getStore());
}
$this->_oldStoreId = Mage::app()->getStore()->getId();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$this->_oldFieldsetRenderer = Varien_Data_Form::getFieldsetRenderer();
$this->_oldFieldsetElementRenderer = Varien_Data_Form::getFieldsetElementRenderer();
Varien_Data_Form::setFieldsetRenderer($this->getLayout()->createBlock('udprod/vendor_product_renderer_fieldset'));
Varien_Data_Form::setFieldsetElementRenderer($this->getLayout()->createBlock('udprod/vendor_product_renderer_fieldsetElement'));
return $this;
}
示例4: getConditionsForm
/**
* @return Varien_Data_Form
*/
public function getConditionsForm($rule = null)
{
/** @var Aoe_FraudManager_Model_Rule_Abstract $rule */
if (!$rule) {
$rule = $this->getCurrentRecord();
}
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('rule_');
$fieldset = $form->addFieldset('conditions_fieldset', ['legend' => $this->__('Apply the rule only if the following conditions are met')]);
$renderer = clone $form->getFieldsetRenderer();
$renderer->setTemplate('promo/fieldset.phtml');
$renderer->setNewChildUrl($this->getUrl('*/*/condition', ['form' => $fieldset->getHtmlId()]));
$fieldset->setRenderer($renderer);
$conditionsElement = $fieldset->addField('conditions', 'text', ['name' => 'conditions', 'label' => $this->__('Conditions'), 'title' => $this->__('Conditions')]);
$conditionsElement->setRenderer(Mage::getSingleton('Aoe_FraudManager/Form_Element_Renderer_Conditions'));
$form->addValues(['conditions' => $rule->getConditions()]);
return $form;
}
示例5: __construct
/**
* Enter description here...
*
* @param array $attributes
*/
public function __construct($attributes = array())
{
parent::__construct($attributes);
$this->_renderer = Varien_Data_Form::getFieldsetRenderer();
$this->setType('fieldset');
}