Thursday, April 5, 2012

Re: Default label options?

After looking through the formHelper, I don't see a way of doing this.
So I added the code and submit a pull-request on GitHub.

Hopefully that helps someone else!

Cheers

On Thu, Apr 5, 2012 at 10:12 AM, nabeel <nshahzad@gmail.com> wrote:
Hi all,

Is there a way to set the default label options? I want every label to have a certain class.
Right now, on Form->create(), I call a helper function and pass it the options array, and it appends my default options from the helper, to the form specific ones.
It works rather well:


public function formOptions($params) {

  $params_default = array(
'url' => '', 'type' => 'post',
'class' => 'form-horizontal',
'inputDefaults' => array(
'label' => array('class' => 'control-label'),
'div' => 'control-group',
'between' => '<div class="controls">', 'after' => '</div>',
'error' => array('attributes' => array('wrap' => 'p', 'class' => 'controls help-block'))
)
  );

  return array_merge($params_default, $params);
}


If you're familiar with bootstrap, you can see that's what I'm using.
But that inputDefault of the label options doesn't stick - I don't think there's a way of doing this the way I want to, looking through the formOptions code, I don't see it there. Don't know if there's a way without touching every form.

Any ideas?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: