LordZardeck
LordZardeck

Reputation: 8283

how to have default label class, but different text per input in cakephp 2.x

I know you can define inputDefaults in the Form->create function, but if I define the label class there, and set the text in the individual Form->input function, the class option is removed. Is there any way around this or do I have to re-define the label option completely?

Upvotes: 0

Views: 113

Answers (1)

Anil kumar
Anil kumar

Reputation: 4177

Yes, you've to redefine the label option completely.

$this->Form->input('name', array(
    'label' => array(
        'text' => __('label-text'),
        'class' => 'label-class'
    )
));

your default options are overridden by the options that you've specified for the input method of form helper.

For more information check __parseOptions

Upvotes: 1

Related Questions