lithium\template\helper\Form::_generators()

protected method

Iterates over the configured attribute generators, and modifies the settings for a tag.

Parameters

  • string $method

    The name of the helper method which was called, i.e. 'text', 'select', etc.

  • string $name

    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.

  • array $options

    The options and HTML attributes that will be used to generate the helper output.

Returns

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.

Source

	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;
	}