Cakephp表单单选按钮标签类

Har*_*M V 2 label cakephp radio-button cakephp-2.0

我想使用Form Helper来使用单选按钮.单选按钮具有Radio元素和Label.我默认显示:标签元素的块.我想为一个类分配单选按钮的标签,以便我可以为它分配一个内联块.

$attributes  = array('legend' => false, 'label' => array('class' => 'radioBtn'));
echo $this->Form->radio('gender', $options, $attributes);
Run Code Online (Sandbox Code Playgroud)

如何将类分配给选项的标签

nIc*_*IcO 5

通过查看Form-> radio()方法代码,似乎没有任何东西与属于标签的属性相关.

但要修改这些标签的显示,您可以使用周围环境 div

echo '<div class="inline_labels">';
echo $this->Form->radio('gender', $options, $attributes);
echo '</div>';
Run Code Online (Sandbox Code Playgroud)

并使用这样的CSS:

.inline_labels label
{
    display: inline-block;
}
Run Code Online (Sandbox Code Playgroud)