Allows you to configure a default set of options which are included on a per-method basis, and configure method template overrides.
To force all `<label />` elements to have a default `class` attribute value of `"foo"`, simply do the following: {{{ $this->form->config(array('label' => array('class' => 'foo'))); }}} Note that this can be overridden on a case-by-case basis, and when overriding, values are not merged or combined. Therefore, if you wanted a particular `<label />` to have both `foo` and `bar` as classes, you would have to specify `'class' => 'foo bar'`. You can also use this method to change the string template that a method uses to render its content. For example, the default template for rendering a checkbox is `'<input type="checkbox" name="{:name}"{:options} />'`. However, suppose you implemented your own custom UI elements, and you wanted to change the markup used, you could do the following: {{{ $this->form->config(array('templates' => array( 'checkbox' => '<div id="{:name}" class="ui-checkbox-element"{:options}></div>' ))); }}} Now, for any calls to `$this->form->checkbox()`, your custom markup template will be applied. This works for any `Form` method that renders HTML elements.

Parameters

  • array $config An associative array where the keys are `Form` method names (or `'templates'`, to include a template-overriding sub-array), and the values are arrays of configuration options to be included in the `$options` parameter of each method specified.

Returns

array Returns an array containing the currently set per-method configurations, and an array of the currently set template overrides (in the `'templates'` array key).

Source

						public function config(array $config = array()) {
		if (!$config) {
			$keys = array('base' => '', 'text' => '', 'textarea' => '', 'attributes' => '');
			return array('templates' => $this->_templateMap) + array_intersect_key(
				$this->_config, $keys
			);
		}
		if (isset($config['templates'])) {
			$this->_templateMap = $config['templates'] + $this->_templateMap;
			unset($config['templates']);
		}
		return ($this->_config = Set::merge($this->_config, $config)) + array(
			'templates' => $this->_templateMap
		);
	}