Cake\View\Helper\FormHelper::_inputType PHP Метод

_inputType() защищенный Метод

Returns the input type that was guessed for the provided fieldName, based on the internal type it is associated too, its name and the variables that can be found in the view template
protected _inputType ( string $fieldName, array $options ) : string
$fieldName string the name of the field to guess a type for
$options array the options passed to the input method
Результат string
    protected function _inputType($fieldName, $options)
    {
        $context = $this->_getContext();
        if ($context->isPrimaryKey($fieldName)) {
            return 'hidden';
        }
        if (substr($fieldName, -3) === '_id') {
            return 'select';
        }
        $internalType = $context->type($fieldName);
        $map = $this->_config['typeMap'];
        $type = isset($map[$internalType]) ? $map[$internalType] : 'text';
        $fieldName = array_slice(explode('.', $fieldName), -1)[0];
        switch (true) {
            case isset($options['checked']):
                return 'checkbox';
            case isset($options['options']):
                return 'select';
            case in_array($fieldName, ['passwd', 'password']):
                return 'password';
            case in_array($fieldName, ['tel', 'telephone', 'phone']):
                return 'tel';
            case $fieldName === 'email':
                return 'email';
            case isset($options['rows']) || isset($options['cols']):
                return 'textarea';
        }
        return $type;
    }