Extends
lithium\template\Helper
Builds the defaults array for a method by name, according to the config.
Parameters
- string $method The name of the method to create defaults for.
- string $name The `$name` supplied to the original method.
- string $options `$options` from the original method.
Returns
array Defaults array contents.Source
protected function _defaults($method, $name, $options) {
$methodConfig = isset($this->_config[$method]) ? $this->_config[$method] : array();
$options += $methodConfig + $this->_config['base'];
$options = $this->_generators($method, $name, $options);
$hasValue = (
(!isset($options['value']) || $options['value'] === null) &&
$name && $value = $this->binding($name)->data
);
if ($hasValue) {
$options['value'] = $value;
}
if (isset($options['default']) && empty($options['value'])) {
$options['value'] = $options['default'];
}
unset($options['default']);
$generator = $this->_config['attributes']['name'];
$name = $generator($method, $name, $options);
$tplKey = isset($options['template']) ? $options['template'] : $method;
$template = isset($this->_templateMap[$tplKey]) ? $this->_templateMap[$tplKey] : $tplKey;
return array($name, $options, $template);
}