lithium\template\helper\Form::_generators PHP Method

_generators() protected method

Iterates over the configured attribute generators, and modifies the settings for a tag.
protected _generators ( string $method, string $name, array $options ) : array
$method string The name of the helper method which was called, i.e. `'text'`, `'select'`, etc.
$name string The name of the field whose attributes are being generated. Some helper methods, such as `create()` and `end()`, are not field-based, and therefore will have no name.
$options array The options and HTML attributes that will be used to generate the helper output.
return array Returns the value of the `$options` array, modified by the attribute generators added in the `'attributes'` key of the helper's configuration. Note that if a generator is present for a field whose value is `false`, that field will be removed from the array.
    protected function _generators($method, $name, $options)
    {
        foreach ($this->_config['attributes'] as $key => $generator) {
            if ($key === 'name') {
                continue;
            }
            if ($generator && !isset($options[$key])) {
                if (($attr = $generator($method, $name, $options)) !== null) {
                    $options[$key] = $attr;
                }
                continue;
            }
            if ($generator && $options[$key] === false) {
                unset($options[$key]);
            }
        }
        return $options;
    }