We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created by Ricky Dunlop, 5th Jan 2012. (originally Lighthouse ticket #2438):
I extended the FormHelper in order to set inputDefaults for every form so that I don't have to pass the settings in the view each time.
In my helper I have the following
protected $_inputDefaults = array( 'div' => 'control-group', 'between' => '<div class="controls">', 'after' => '</div>' );
The inputDefaults were not merged
In order to get this to work I had to copy the entire create method from the FormHelper to my helper and change line 363 from
$this->_inputDefaults = $options['inputDefaults'];
to
$this->_inputDefaults = array_merge($this->_inputDefaults, $options['inputDefaults']);
The text was updated successfully, but these errors were encountered:
5th Jan 2012, Tigran Gabrielyan said:
You could have done
public function create($model = null, $options = array()) { if (isset($options['inputDefaults'])) { $options['inputDefaults'] = array_merge($this->_inputDefaults, $options['inputDefaults']); } return parent::create($model, $options); }
No need to copy the whole method over.
Sorry, something went wrong.
I think you need something more like:
public function create($model = null, $options = array()) { if (!isset($options['inputDefaults'])) { $options['inputDefaults'] = array(); } $options['inputDefaults'] = array_merge($this->_inputDefaults, $options['inputDefaults']); return parent::create($model, $options); }
.. you get the idea :P
5th Feb 2013, Charles Gold said:
After following the "patch" advice from Tigran...
I am getting the following error in my view, any help? Notice (8): Array to string conversion [CORE\Cake\View\Helper.php, line 486]
See attached customized "MyFormHelper.php"
The FormHelper has been improved vastly in 3.0 and as probably nobody is motivated to implement that patch into the core, we can close this issue.
You can use FormHelper::inputDefaults() with merge param true to achieve similar result.
FormHelper::inputDefaults()
true
😫 shouldn't work on issues deep in the night ;-)
No branches or pull requests
Created by Ricky Dunlop, 5th Jan 2012. (originally Lighthouse ticket #2438):
What I did
I extended the FormHelper in order to set inputDefaults for every form so that I don't have to pass the settings in the view each time.
In my helper I have the following
What happened
The inputDefaults were not merged
In order to get this to work I had to copy the entire create method from the FormHelper to my helper and change line 363 from
to
The text was updated successfully, but these errors were encountered: