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


PHP AppHelper::_initInputField方法代码示例

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


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

示例1: _initInputField

/**
 * Sets field defaults and adds field to form security input hash.
 * Will also add a 'form-error' class if the field contains validation errors.
 *
 * ### Options
 *
 * - `secure` - boolean whether or not the field should be added to the security fields.
 *   Disabling the field using the `disabled` option, will also omit the field from being
 *   part of the hashed key.
 *
 * This method will convert a numerically indexed 'disabled' into a associative
 * value. FormHelper's internals expect associative options.
 *
 * @param string $field Name of the field to initialize options for.
 * @param array $options Array of options to append options into.
 * @return array Array of options for the input.
 */
	protected function _initInputField($field, $options = array()) {
		if (isset($options['secure'])) {
			$secure = $options['secure'];
			unset($options['secure']);
		} else {
			$secure = (isset($this->request['_Token']) && !empty($this->request['_Token']));
		}

		$disabledIndex = array_search('disabled', $options, true);
		if (is_int($disabledIndex)) {
			unset($options[$disabledIndex]);
			$options['disabled'] = true;
		}

		$result = parent::_initInputField($field, $options);
		if ($this->tagIsInvalid() !== false) {
			$result = $this->addClass($result, 'form-error');
		}
		if (!empty($result['disabled']) || $secure === self::SECURE_SKIP) {
			return $result;
		}
		if (!isset($result['required']) &&
			$this->_introspectModel($this->model(), 'validates', $this->field())
		) {
			$result['required'] = true;
		}

		$this->_secure($secure, $this->_secureFieldName($options));
		return $result;
	}
开发者ID:hungnt88,项目名称:5stars-1,代码行数:47,代码来源:FormHelper.php

示例2: _initInputField

 /**
  * Sets field defaults and adds field to form security input hash
  *
  * ### Options
  *
  *  - `secure` - boolean whether or not the field should be added to the security fields.
  *
  * @param string $field Name of the field to initialize options for.
  * @param array $options Array of options to append options into.
  * @return array Array of options for the input.
  */
 protected function _initInputField($field, $options = array())
 {
     if (isset($options['secure'])) {
         $secure = $options['secure'];
         unset($options['secure']);
     } else {
         $secure = isset($this->request['_Token']) && !empty($this->request['_Token']);
     }
     $fieldName = null;
     if ($secure && !empty($options['name'])) {
         preg_match_all('/\\[(.*?)\\]/', $options['name'], $matches);
         if (isset($matches[1])) {
             $fieldName = $matches[1];
         }
     }
     $result = parent::_initInputField($field, $options);
     if ($secure) {
         $this->__secure($fieldName);
     }
     return $result;
 }
开发者ID:robotarmy,项目名称:Phog,代码行数:32,代码来源:form.php

示例3: array

 /**
  * Sets field defaults and adds field to form security input hash
  *
  * Options
  *
  *  - `secure` - boolean whether or not the the field should be added to the security fields.
  *
  * @param string $field Name of the field to initialize options for.
  * @param array $options Array of options to append options into.
  * @return array Array of options for the input.
  * @access protected
  */
 function _initInputField($field, $options = array())
 {
     if (isset($options['secure'])) {
         $secure = $options['secure'];
         unset($options['secure']);
     } else {
         $secure = isset($this->params['_Token']) && !empty($this->params['_Token']);
     }
     $result = parent::_initInputField($field, $options);
     if ($secure) {
         $this->__secure();
     }
     return $result;
 }
开发者ID:johnulist,项目名称:Markab,代码行数:26,代码来源:form.php

示例4: _initInputField

 /**
  * Sets field defaults and adds field to form security input hash
  *
  * ### Options
  *
  * - `secure` - boolean whether or not the field should be added to the security fields.
  *   Disabling the field using the `disabled` option, will also omit the field from being
  *   part of the hashed key.
  *
  * @param string $field Name of the field to initialize options for.
  * @param array $options Array of options to append options into.
  * @return array Array of options for the input.
  */
 protected function _initInputField($field, $options = array())
 {
     if (isset($options['secure'])) {
         $secure = $options['secure'];
         unset($options['secure']);
     } else {
         $secure = isset($this->request['_Token']) && !empty($this->request['_Token']);
     }
     $result = parent::_initInputField($field, $options);
     if ($this->tagIsInvalid() !== false) {
         $result = $this->addClass($result, 'form-error');
     }
     if (!empty($result['disabled']) || $secure === self::SECURE_SKIP) {
         return $result;
     }
     $fieldName = null;
     if (!empty($options['name'])) {
         preg_match_all('/\\[(.*?)\\]/', $options['name'], $matches);
         if (isset($matches[1])) {
             $fieldName = $matches[1];
         }
     }
     $this->_secure($secure, $fieldName);
     return $result;
 }
开发者ID:Juan09130424,项目名称:CakePHP---Bootstrap-template,代码行数:38,代码来源:FormHelper.php

示例5: _initInputField

 /**
  * Sets field defaults and adds field to form security input hash.
  * Will also add a 'form-error' class if the field contains validation errors.
  *
  * ### Options
  *
  * - `secure` - boolean whether or not the field should be added to the security fields.
  *   Disabling the field using the `disabled` option, will also omit the field from being
  *   part of the hashed key.
  *
  * This method will convert a numerically indexed 'disabled' into an associative
  * value. FormHelper's internals expect associative options.
  *
  * @param string $field   Name of the field to initialize options for.
  * @param array  $options Array of options to append options into.
  *
  * @return array Array of options for the input.
  */
 protected function _initInputField($field, $options = array())
 {
     if (isset($options['secure'])) {
         $secure = $options['secure'];
         unset($options['secure']);
     } else {
         $secure = isset($this->request['_Token']) && !empty($this->request['_Token']);
     }
     $disabledIndex = array_search('disabled', $options, TRUE);
     if (is_int($disabledIndex)) {
         unset($options[$disabledIndex]);
         $options['disabled'] = TRUE;
     }
     $result = parent::_initInputField($field, $options);
     if ($this->tagIsInvalid() !== FALSE) {
         $result = $this->addClass($result, 'form-error');
     }
     $isDisabled = FALSE;
     if (isset($result['disabled'])) {
         $isDisabled = $result['disabled'] === TRUE || $result['disabled'] === 'disabled' || is_array($result['disabled']) && !empty($result['options']) && array_diff($result['options'], $result['disabled']) === array();
     }
     if ($isDisabled) {
         return $result;
     }
     if (!isset($result['required']) && $this->_introspectModel($this->model(), 'validates', $this->field())) {
         $result['required'] = TRUE;
     }
     if ($secure === static::SECURE_SKIP) {
         return $result;
     }
     $this->_secure($secure, $this->_secureFieldName($options));
     return $result;
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:51,代码来源:FormHelper.php


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