2015-03-02 69 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