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


PHP HTML_QuickForm_element::_generateId方法代码示例

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


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

示例1: renderElement

 /**
  * Renders element
  *
  * @param HTML_QuickForm_element $element element
  * @param bool $required if input is required field
  * @param string $error error message to display
  */
 function renderElement(&$element, $required, $error)
 {
     // Make sure the element has an id.
     $element->_generateId();
     //adding stuff to place holders in template
     //check if this is a group element first
     if ($this->_inGroup and !empty($this->_groupElementTemplate)) {
         // so it gets substitutions for *each* element
         $html = $this->_groupElementTemplate;
     } elseif (method_exists($element, 'getElementTemplateType')) {
         $html = $this->_elementTemplates[$element->getElementTemplateType()];
     } else {
         $html = $this->_elementTemplates['default'];
     }
     if (isset($this->_advancedElements[$element->getName()])) {
         $html = str_replace(' {advanced}', ' advanced', $html);
         $html = str_replace(' {aria-live}', ' aria-live="polite"', $html);
     } else {
         $html = str_replace(' {advanced}', '', $html);
         $html = str_replace(' {aria-live}', '', $html);
     }
     if (isset($this->_advancedElements[$element->getName()]) || $element->getName() == 'mform_showadvanced') {
         $html = str_replace('{advancedimg}', $this->_advancedHTML, $html);
     } else {
         $html = str_replace('{advancedimg}', '', $html);
     }
     $html = str_replace('{id}', 'fitem_' . $element->getAttribute('id'), $html);
     $html = str_replace('{type}', 'f' . $element->getType(), $html);
     $html = str_replace('{name}', $element->getName(), $html);
     $emptylabel = '';
     if ($element->getLabel() == '') {
         $emptylabel = 'femptylabel';
     }
     $html = str_replace('{emptylabel}', $emptylabel, $html);
     if (method_exists($element, 'getHelpButton')) {
         $html = str_replace('{help}', $element->getHelpButton(), $html);
     } else {
         $html = str_replace('{help}', '', $html);
     }
     if ($this->_inGroup and !empty($this->_groupElementTemplate)) {
         $this->_groupElementTemplate = $html;
     } elseif (!isset($this->_templates[$element->getName()])) {
         $this->_templates[$element->getName()] = $html;
     }
     parent::renderElement($element, $required, $error);
 }
开发者ID:educacionbe,项目名称:cursos,代码行数:53,代码来源:formslib.php

示例2: renderElement

 /**
  * Renders element
  *
  * @param HTML_QuickForm_element $element element
  * @param bool $required if input is required field
  * @param string $error error message to display
  */
 function renderElement(&$element, $required, $error)
 {
     global $OUTPUT;
     // Make sure the element has an id.
     $element->_generateId();
     $advanced = isset($this->_advancedElements[$element->getName()]);
     $html = $OUTPUT->mform_element($element, $required, $advanced, $error, false);
     $fromtemplate = !empty($html);
     if (!$fromtemplate) {
         // Adding stuff to place holders in template
         // check if this is a group element first.
         if ($this->_inGroup and !empty($this->_groupElementTemplate)) {
             // So it gets substitutions for *each* element.
             $html = $this->_groupElementTemplate;
         } else {
             if (method_exists($element, 'getElementTemplateType')) {
                 $html = $this->_elementTemplates[$element->getElementTemplateType()];
             } else {
                 $html = $this->_elementTemplates['default'];
             }
         }
         if (isset($this->_advancedElements[$element->getName()])) {
             $html = str_replace(' {advanced}', ' advanced', $html);
             $html = str_replace(' {aria-live}', ' aria-live="polite"', $html);
         } else {
             $html = str_replace(' {advanced}', '', $html);
             $html = str_replace(' {aria-live}', '', $html);
         }
         if (isset($this->_advancedElements[$element->getName()]) || $element->getName() == 'mform_showadvanced') {
             $html = str_replace('{advancedimg}', $this->_advancedHTML, $html);
         } else {
             $html = str_replace('{advancedimg}', '', $html);
         }
         $html = str_replace('{id}', 'fitem_' . $element->getAttribute('id'), $html);
         $html = str_replace('{typeclass}', 'f' . $element->getType(), $html);
         $html = str_replace('{type}', $element->getType(), $html);
         $html = str_replace('{name}', $element->getName(), $html);
         $html = str_replace('{class}', $element->getAttribute('class'), $html);
         $emptylabel = '';
         if ($element->getLabel() == '') {
             $emptylabel = 'femptylabel';
         }
         $html = str_replace('{emptylabel}', $emptylabel, $html);
         if (method_exists($element, 'getHelpButton')) {
             $html = str_replace('{help}', $element->getHelpButton(), $html);
         } else {
             $html = str_replace('{help}', '', $html);
         }
     } else {
         if ($this->_inGroup) {
             $this->_groupElementTemplate = $html;
         }
     }
     if ($this->_inGroup and !empty($this->_groupElementTemplate)) {
         $this->_groupElementTemplate = $html;
     } else {
         if (!isset($this->_templates[$element->getName()])) {
             $this->_templates[$element->getName()] = $html;
         }
     }
     if (!$fromtemplate) {
         parent::renderElement($element, $required, $error);
     } else {
         if (in_array($element->getName(), $this->_stopFieldsetElements) && $this->_fieldsetsOpen > 0) {
             $this->_html .= $this->_closeFieldsetTemplate;
             $this->_fieldsetsOpen--;
         }
         $this->_html .= $html;
     }
 }
开发者ID:dg711,项目名称:moodle,代码行数:77,代码来源:formslib.php


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