Made FormHelper::inputDefaults() alawys return inputDefaults array

This commit is contained in:
Tigran Gabrielyan 2012-05-20 15:51:48 -07:00
parent fd0dd7ec04
commit 57ad5e2573

View file

@ -2588,17 +2588,13 @@ class FormHelper extends AppHelper {
*
* @param array $defaults New default values
* @param boolean Merge with current defaults
* @return mixed array|void Current inputDefaults
* @return array inputDefaults
*/
public function inputDefaults($defaults = null, $merge = false) {
if (is_null($defaults)) {
return $this->_inputDefaults;
}
if ($merge) {
$this->_inputDefaults = array_merge($this->_inputDefaults, (array)$defaults);
} else {
$this->_inputDefaults = (array)$defaults;
if (!is_null($defaults)) {
$this->_inputDefaults = array_merge($merge ? $this->_inputDefaults : array(), (array)$defaults);
}
return $this->_inputDefaults;
}
}