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

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

$options can contain a hash of id overrides. These overrides will be used instead of the generated values if present.
protected _inputLabel ( string $fieldName, string $label, array $options ) : string
$fieldName string The name of the field to generate label for.
$label string Label text.
$options array Options for the label element.
Результат string Generated label element
    protected function _inputLabel($fieldName, $label, $options)
    {
        $options += ['id' => null, 'input' => null, 'nestedInput' => false, 'templateVars' => []];
        $labelAttributes = ['templateVars' => $options['templateVars']];
        if (is_array($label)) {
            $labelText = null;
            if (isset($label['text'])) {
                $labelText = $label['text'];
                unset($label['text']);
            }
            $labelAttributes = array_merge($labelAttributes, $label);
        } else {
            $labelText = $label;
        }
        $labelAttributes['for'] = $options['id'];
        $groupTypes = ['radio', 'multicheckbox', 'date', 'time', 'datetime'];
        if (in_array($options['type'], $groupTypes, true)) {
            $labelAttributes['for'] = false;
        }
        if ($options['nestedInput']) {
            $labelAttributes['input'] = $options['input'];
        }
        if (isset($options['escape'])) {
            $labelAttributes['escape'] = $options['escape'];
        }
        return $this->label($fieldName, $labelText, $labelAttributes);
    }