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


PHP HTML_QuickForm_element::getType方法代码示例

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


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

示例1: mform_element

 /**
  * Renders an mform element from a template.
  *
  * @param HTML_QuickForm_element $element element
  * @param bool $required if input is required field
  * @param bool $advanced if input is an advanced field
  * @param string $error error message to display
  * @param bool $ingroup True if this element is rendered as part of a group
  * @return mixed string|bool
  */
 public function mform_element($element, $required, $advanced, $error, $ingroup)
 {
     $templatename = 'core_form/element-' . $element->getType();
     if ($ingroup) {
         $templatename .= "-inline";
     }
     try {
         // We call this to generate a file not found exception if there is no template.
         // We don't want to call export_for_template if there is no template.
         core\output\mustache_template_finder::get_template_filepath($templatename);
         if ($element instanceof templatable) {
             $elementcontext = $element->export_for_template($this);
             $helpbutton = '';
             if (method_exists($element, 'getHelpButton')) {
                 $helpbutton = $element->getHelpButton();
             }
             $label = $element->getLabel();
             if (method_exists($element, 'getText')) {
                 $label .= ' ' . $element->getText();
             }
             $context = array('element' => $elementcontext, 'label' => $label, 'required' => $required, 'advanced' => $advanced, 'helpbutton' => $helpbutton, 'error' => $error);
             return $this->render_from_template($templatename, $context);
         }
     } catch (Exception $e) {
         // No template for this element.
         return false;
     }
 }
开发者ID:dg711,项目名称:moodle,代码行数:38,代码来源:outputrenderers.php

示例2: updateAttributes

 /**
  * Update the attributes of this element and add a few CiviCRM
  * based attributes so we can style this form element better
  *
  *
  * @param HTML_QuickForm_element $element
  * @param bool $required
  *   Whether an element is required.
  * @param string $error
  *   Error associated with the element.
  *
  */
 public static function updateAttributes(&$element, $required, $error)
 {
     // lets create an id for all input elements, so we can generate nice label tags
     // to make it nice and clean, we'll just use the elementName if it is non null
     $attributes = array();
     if (!$element->getAttribute('id')) {
         $name = $element->getAttribute('name');
         if ($name) {
             $attributes['id'] = str_replace(array(']', '['), array('', '_'), $name);
         }
     }
     $class = $element->getAttribute('class');
     $type = $element->getType();
     if (!$class) {
         if ($type == 'text') {
             $size = $element->getAttribute('size');
             if (!empty($size)) {
                 $class = CRM_Utils_Array::value($size, self::$_sizeMapper);
             }
         }
     }
     if ($type == 'select' && $element->getAttribute('multiple')) {
         $type = 'multiselect';
     }
     // Add widget-specific class
     if (!$class || strpos($class, 'crm-form-') === FALSE) {
         $class = ($class ? "{$class} " : '') . 'crm-form-' . $type;
     } elseif (strpos($class, 'crm-form-entityref') !== FALSE) {
         self::preProcessEntityRef($element);
     } elseif (strpos($class, 'crm-form-contact-reference') !== FALSE) {
         self::preprocessContactReference($element);
     }
     if ($required) {
         $class .= ' required';
     }
     if ($error) {
         $class .= ' error';
     }
     $attributes['class'] = $class;
     $element->updateAttributes($attributes);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:53,代码来源:Renderer.php

示例3: _setErrorAttribute

 /**
  * エラー項目の背景色を設定する
  * (QuickFormの項目に対して、背景色を設定する)
  * @access public
  * @param HTML_QuickForm_element $element エラー項目
  */
 private function _setErrorAttribute(&$element)
 {
     if ('group' == $element->getType()) {
         $elements = $element->getElements();
         foreach ($elements as $value) {
             $this->_setErrorAttribute($value);
         }
     } else {
         $attr = $element->getAttributes();
         $attr['style'] = S4_ERROR_COLUMN_COLOR;
         $element->setAttributes($attr);
     }
 }
开发者ID:nkawa,项目名称:acs-git-test,代码行数:19,代码来源:ViewEx.class.php

示例4: guess_element_id

 /**
  * Returns the CSS id attribute that will be assigned by moodleform later to this element
  * @param stdClass $item
  * @param HTML_QuickForm_element $element
  */
 protected function guess_element_id($item, $element)
 {
     if (!($id = $element->getAttribute('id'))) {
         $attributes = $element->getAttributes();
         $id = $attributes['id'] = 'feedback_item_' . $item->id;
         $element->setAttributes($attributes);
     }
     if ($element->getType() === 'group') {
         return 'fgroup_' . $id;
     }
     return 'fitem_' . $id;
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:17,代码来源:complete_form.php


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