本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}