當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Varien_Data_Form_Element_Fieldset::addElement方法代碼示例

本文整理匯總了PHP中Varien_Data_Form_Element_Fieldset::addElement方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Data_Form_Element_Fieldset::addElement方法的具體用法?PHP Varien_Data_Form_Element_Fieldset::addElement怎麽用?PHP Varien_Data_Form_Element_Fieldset::addElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Varien_Data_Form_Element_Fieldset的用法示例。


在下文中一共展示了Varien_Data_Form_Element_Fieldset::addElement方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _initGroup

 /**
  * Init config group
  *
  * @param Varien_Data_Form $form
  * @param Varien_Simplexml_Element $group
  * @param Varien_Simplexml_Element $section
  * @param Varien_Data_Form_Element_Fieldset|null $parentElement
  */
 protected function _initGroup($form, $group, $section, $parentElement = null)
 {
     if ($group->frontend_model) {
         $fieldsetRenderer = Mage::getBlockSingleton((string) $group->frontend_model);
     } else {
         $fieldsetRenderer = $this->_defaultFieldsetRenderer;
     }
     $fieldsetRenderer->setForm($this)->setConfigData($this->_configData);
     if ($this->_configFields->hasChildren($group, $this->getWebsiteCode(), $this->getStoreCode())) {
         $helperName = $this->_configFields->getAttributeModule($section, $group);
         $fieldsetConfig = array('legend' => Mage::helper($helperName)->__((string) $group->label));
         if (!empty($group->comment)) {
             $fieldsetConfig['comment'] = Mage::helper($helperName)->__((string) $group->comment);
         }
         if (!empty($group->expanded)) {
             $fieldsetConfig['expanded'] = (bool) $group->expanded;
         }
         $fieldset = new Varien_Data_Form_Element_Fieldset($fieldsetConfig);
         $fieldset->setId($section->getName() . '_' . $group->getName())->setRenderer($fieldsetRenderer)->setGroup($group);
         if ($parentElement) {
             $fieldset->setIsNested(true);
             $parentElement->addElement($fieldset);
         } else {
             $form->addElement($fieldset);
         }
         $this->_prepareFieldOriginalData($fieldset, $group);
         $this->_addElementTypes($fieldset);
         $this->_fieldsets[$group->getName()] = $fieldset;
         if ($group->clone_fields) {
             if ($group->clone_model) {
                 $cloneModel = Mage::getModel((string) $group->clone_model);
             } else {
                 Mage::throwException($this->__('Config form fieldset clone model required to be able to clone fields'));
             }
             foreach ($cloneModel->getPrefixes() as $prefix) {
                 $this->initFields($fieldset, $group, $section, $prefix['field'], $prefix['label']);
             }
         } else {
             $this->initFields($fieldset, $group, $section);
         }
     }
 }
開發者ID:monkviper,項目名稱:magento-lite,代碼行數:50,代碼來源:Form.php


注:本文中的Varien_Data_Form_Element_Fieldset::addElement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。