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


PHP HTML_QuickForm::errorMessage方法代码示例

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


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

示例1: array

 /**
  * Simple easy to use wrapper around addElement. Deal with
  * simple validation rules
  *
  * @param string $type
  * @param string $name
  * @param string $label
  * @param string|array $attributes (options for select elements)
  * @param bool $required
  * @param array $extra
  *   (attributes for select elements).
  *
  * @return HTML_QuickForm_Element could be an error object
  */
 public function &add($type, $name, $label = '', $attributes = '', $required = FALSE, $extra = NULL)
 {
     if ($type == 'wysiwyg') {
         $attributes = ($attributes ? $attributes : array()) + array('class' => '');
         $attributes['class'] .= ' crm-form-wysiwyg';
         $type = "textarea";
     }
     if ($type == 'select' && is_array($extra)) {
         // Normalize this property
         if (!empty($extra['multiple'])) {
             $extra['multiple'] = 'multiple';
         } else {
             unset($extra['multiple']);
         }
         // Add placeholder option for select
         if (isset($extra['placeholder'])) {
             if ($extra['placeholder'] === TRUE) {
                 $extra['placeholder'] = $required ? ts('- select -') : ts('- none -');
             }
             if (($extra['placeholder'] || $extra['placeholder'] === '') && empty($extra['multiple']) && is_array($attributes) && !isset($attributes[''])) {
                 $attributes = array('' => $extra['placeholder']) + $attributes;
             }
         }
     }
     $element = $this->addElement($type, $name, $label, $attributes, $extra);
     if (HTML_QuickForm::isError($element)) {
         CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element));
     }
     if ($required) {
         if ($type == 'file') {
             $error = $this->addRule($name, ts('%1 is a required field.', array(1 => $label)), 'uploadedfile');
         } else {
             $error = $this->addRule($name, ts('%1 is a required field.', array(1 => $label)), 'required');
         }
         if (HTML_QuickForm::isError($error)) {
             CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element));
         }
     }
     return $element;
 }
开发者ID:hoegrammer,项目名称:civicrm-core,代码行数:54,代码来源:Form.php

示例2: HTML_QuickForm_Error

 /**
  * Creates a quickform error object, extending the PEAR_Error class
  *
  * @param int   $code the error code
  * @param int   $mode the reaction to the error, either return, die or trigger/callback
  * @param int   $level intensity of the error (PHP error code)
  * @param mixed $debuginfo any information that can inform user as to nature of the error
  */
 function HTML_QuickForm_Error($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
 {
     if (is_int($code)) {
         $this->PEAR_Error(HTML_QuickForm::errorMessage($code), $code, $mode, $level, $debuginfo);
     } else {
         $this->PEAR_Error("Invalid error code: {$code}", QUICKFORM_ERROR, $mode, $level, $debuginfo);
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:16,代码来源:QuickForm.php

示例3: __construct

 /**
  * Creates a quickform error object, extending the PEAR_Error class
  *
  * @param int   $code the error code
  * @param int   $mode the reaction to the error, either return, die or trigger/callback
  * @param int   $level intensity of the error (PHP error code)
  * @param mixed $debuginfo any information that can inform user as to nature of the error
  */
 public function __construct($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
 {
     if (is_int($code)) {
         parent::__construct(HTML_QuickForm::errorMessage($code), $code, $mode, $level, $debuginfo);
     } else {
         parent::__construct("Invalid error code: {$code}", QUICKFORM_ERROR, $mode, $level, $debuginfo);
     }
 }
开发者ID:elie89,项目名称:moodle,代码行数:16,代码来源:QuickForm.php

示例4: array

 /**
  * Simple easy to use wrapper around addElement.
  *
  * Deal with simple validation rules.
  *
  * @param string $type
  * @param string $name
  * @param string $label
  * @param string|array $attributes (options for select elements)
  * @param bool $required
  * @param array $extra
  *   (attributes for select elements).
  *
  * @return HTML_QuickForm_Element
  *   Could be an error object
  */
 public function &add($type, $name, $label = '', $attributes = '', $required = FALSE, $extra = NULL)
 {
     // Fudge some extra types that quickform doesn't support
     if ($type == 'wysiwyg' || in_array($type, self::$html5Types)) {
         $attributes = ($attributes ? $attributes : array()) + array('class' => '');
         $attributes['class'] = ltrim($attributes['class'] . " crm-form-{$type}");
         $type = $type == 'wysiwyg' ? 'textarea' : 'text';
     }
     // @see http://wiki.civicrm.org/confluence/display/CRMDOC/crmDatepicker
     if ($type == 'datepicker') {
         $attributes = $attributes ? $attributes : array();
         $attributes['data-crm-datepicker'] = json_encode((array) $extra);
         $type = "text";
     }
     if ($type == 'select' && is_array($extra)) {
         // Normalize this property
         if (!empty($extra['multiple'])) {
             $extra['multiple'] = 'multiple';
         } else {
             unset($extra['multiple']);
         }
         unset($extra['size'], $extra['maxlength']);
         // Add placeholder option for select
         if (isset($extra['placeholder'])) {
             if ($extra['placeholder'] === TRUE) {
                 $extra['placeholder'] = $required ? ts('- select -') : ts('- none -');
             }
             if (($extra['placeholder'] || $extra['placeholder'] === '') && empty($extra['multiple']) && is_array($attributes) && !isset($attributes[''])) {
                 $attributes = array('' => $extra['placeholder']) + $attributes;
             }
         }
     }
     $element = $this->addElement($type, $name, $label, $attributes, $extra);
     if (HTML_QuickForm::isError($element)) {
         CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element));
     }
     if ($required) {
         if ($type == 'file') {
             $error = $this->addRule($name, ts('%1 is a required field.', array(1 => $label)), 'uploadedfile');
         } else {
             $error = $this->addRule($name, ts('%1 is a required field.', array(1 => $label)), 'required');
         }
         if (HTML_QuickForm::isError($error)) {
             CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element));
         }
     }
     return $element;
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:64,代码来源:Form.php

示例5: ts

 /**
  * Simple easy to use wrapper around addElement. Deal with
  * simple validation rules
  *
  * @param string type of html element to be added
  * @param string name of the html element
  * @param string display label for the html element
  * @param string attributes used for this element.
  *               These are not default values
  * @param bool   is this a required field
  *
  * @return object    html element, could be an error object
  * @access public
  *
  */
 function &add($type, $name, $label = '', $attributes = '', $required = false, $javascript = null)
 {
     $element =& $this->addElement($type, $name, $label, $attributes, $javascript);
     if (HTML_QuickForm::isError($element)) {
         CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element));
     }
     if ($required) {
         $error = $this->addRule($name, ts('%1 is a required field.', array(1 => $label)), 'required');
         if (HTML_QuickForm::isError($error)) {
             CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element));
         }
     }
     return $element;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:29,代码来源:Form.php


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