当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Data_Form_Element_Fieldset::setForm方法代码示例

本文整理汇总了PHP中Varien_Data_Form_Element_Fieldset::setForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Fieldset::setForm方法的具体用法?PHP Varien_Data_Form_Element_Fieldset::setForm怎么用?PHP Varien_Data_Form_Element_Fieldset::setForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Data_Form_Element_Fieldset的用法示例。


在下文中一共展示了Varien_Data_Form_Element_Fieldset::setForm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepareStage2

 /**
  * Prepares any stage 2 areas of the form
  *
  * @param Varien_Data_Form_Element_Fieldset $stage1Fieldset
  * @throws Exception
  */
 protected function prepareStage2(Varien_Data_Form_Element_Fieldset $stage1Fieldset)
 {
     // Get current event
     $event = $this->getEvent($this->currentData['event_id']);
     $defaultMessageTemplate = $this->getMessageTemplate($this->currentData['store_id'], $this->currentData['event_id']);
     //if there is not a message already set (eg when we are editing)
     //set it as the default message
     if (!isset($this->currentData['message_template'])) {
         $this->currentData['message_template'] = $defaultMessageTemplate;
     }
     $message = 'This is who your message will show as being from on the receiving handset e.g. Mystore.';
     $note = Mage::helper('esendex_sms')->__($message);
     $vmn = $this->getAccountVirtualMobileNumber();
     if ($vmn) {
         $note .= '<br><br>' . $vmn;
     }
     // Add senders select
     $stage1Fieldset->addField('sender', 'text', array('label' => Mage::helper('esendex_sms')->__('From'), 'name' => 'sender', 'required' => true, 'class' => 'required-entry validate-sender-format', 'note' => $note, 'value' => 'Esendex'));
     /** @var Esendex_Sms_Model_Resource_Event $event */
     $model = $event->getEventProcessor();
     $vars = array_map(function (Esendex_Sms_Model_Variable $var) {
         return $var->getReplaceName();
     }, $model->getVariables());
     //sort alphabetically
     sort($vars);
     $variables = sprintf('<li>%s</li>', Mage::helper('esendex_sms')->__('No Available Vars'));
     if (count($vars)) {
         $variables = '<li>' . implode("</li>\n<li>", $vars) . '</li>';
     }
     $link = 'http://support.esendex.co.uk/magento?i=magentosupport&ls=magento&sc=magentotriggervariables&sd=v1';
     $variableHelpLink = '<p class="note" id="variable-help-link"><small>';
     $variableHelpLink .= Mage::helper('esendex_sms')->__('For more information about using variables please visit our <a target="_blank" href="%s">support page</a>', $link);
     $variableHelpLink .= '</a></small></p>';
     $afterElementHtml = sprintf('<p class="note"><small>%s</small></p>', Mage::helper('esendex_sms')->__('These counts do not include variables.'));
     // Build html for message template textarea variables
     $afterElementHtml .= sprintf('<td class="value"><h4>%s</h4><div id="available-variables-container""><ul id="available-variables">%s</ul></div>%s</td>', Mage::helper('esendex_sms')->__('Available Variables'), $variables, $variableHelpLink);
     //add default message template, for JavaScript to pickup
     $afterElementHtml .= sprintf('<td class="hidden" id="default-message-template">%s</td>', $defaultMessageTemplate);
     // Add message template textarea with available areas html
     $stage1Fieldset->addField('message_template', 'textarea', array('label' => Mage::helper('esendex_sms')->__('Message'), 'class' => 'validate-message-count validate-variables', 'name' => 'message_template', 'required' => true, 'after_element_html' => $afterElementHtml));
     // Add description field
     $stage1Fieldset->addField('description', 'text', array('label' => Mage::helper('esendex_sms')->__('Description'), 'name' => 'description', 'required' => false));
     // Add status select
     $stage1Fieldset->addField('status', 'select', array('label' => Mage::helper('esendex_sms')->__('Status'), 'name' => 'status', 'required' => true, 'class' => 'required-entry', 'values' => array(array('value' => 1, 'label' => Mage::helper('esendex_sms')->__('Enabled')), array('value' => 0, 'label' => Mage::helper('esendex_sms')->__('Disabled')))));
     // Stage 2 fieldset legend
     $legend = Mage::helper('esendex_sms')->__("'%s' specific fields", $event->getName());
     // Create stage 2 fieldset
     $stage2Fieldset = new Varien_Data_Form_Element_Fieldset(array('legend' => $legend, 'html_id' => 'form_additional'));
     // Add the form to the fieldset so the fields set their form correctly.
     $stage2Fieldset->setForm($this->getForm());
     // Dispatch Event With Empty Form Field set
     // This lets more complex event types can add their own fields
     $this->dispatchStage2Event($stage2Fieldset, $this->getSelectedEventName($event));
     // Add the field set to the form if it has been extended
     if (count($stage2Fieldset->getSortedElements())) {
         $this->getForm()->addElement($stage2Fieldset);
     }
 }
开发者ID:WeareJH,项目名称:esendex-magento-extension,代码行数:64,代码来源:Form.php


注:本文中的Varien_Data_Form_Element_Fieldset::setForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。