2015-03-02 70 views
0

我有以下multicheckbox:如何使MultiCheckBox标签变大或变强?

$this->add(array(
     'type' => 'DoctrineModule\Form\Element\ObjectMultiCheckbox', 

     'name' => 'directPractice', 
     'options' => array(
      'label' => 'A. Check all direct practice field education assignments', 

     **EDIT 1:** 
     'label_attributes' => array(
       'class' => 'label-multicheckbox-group' 
      ), 


      'object_manager' => $this->getObjectManager(), 
      'target_class' => 'OnlineFieldEvaluation\Entity\FieldEducationAssignments', //'YOUR ENTITY NAMESPACE' 
      'property' => 'directPractice', //'your db collumn name' 
      'value_options' => array(
       '1' => 'Adults', 
       '2' => 'Individuals', 
       '3' => 'Information and Referral', 
       '4' => 'Families', 
      ), 
     ), 
     'attributes' => array(
      'value' => '1', //set checked to '1' 
      'multiple' => true, 
     ) 
    )); 

如何进行以下部分大胆? 使用label_attributes可使所有标签变为粗体,而我只需将多盒的主标签变为粗体。

'label' => 'A. Check all direct practice field education assignments', 

编辑1:添加label_attributes到 “选项”

当我添加label_attributes为@itrascastro建议,所有的标签变得大胆,我想只有最上面的一个变得大胆:multicheckbox

回答

0

由于在选项没有建立公正的顶级标签做到这一点,我用jQuery来实现这一点:

$("label[for]").each(function(){ 
    $(this).addClass("label-bold"); 
}); 
0

尝试添加到您的选择:

'options' => array(
    'label_attributes' => array(
     'class' => 'myCssBoldClass' 
    ), 
    // more options 
), 
+0

我以前尝试过。它使所有标签变成粗体,我只希望最上面的一个变得粗体。我编辑了我的问题。 – vlr 2015-03-02 19:15:56

0

每个值选项accepts an array of options

例如

'value_options' => [ 
    [ 
     'label' => 'Adults', 
     'label_attributes' => [ 
      'class' => 'my-bold-class', 
     ], 
     'attributes' => [], 
     'value' => 1, 
     'selected' => false, 
     'disabled' => false, 
    ], 
    '2' => 'Individuals', 
    '3' => 'Information and Referral', 
    '4' => 'Families', 
], 

我在,你可以定义一些其他值增加;他们显然是可选的。

+0

是的,但我怎样才能做出只有顶级的大胆,和其他常规?请注意,如果我将它定义为顶级单元格,它们将如何变为粗体:http://take.ms/RSCsP – vlr 2015-03-05 04:11:07

+0

对不起,我想我不清楚。我希望它只适用于这个选项: “A.检查所有直接实践现场教育作业” – vlr 2015-03-05 18:30:15