當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。