Zend framework2 如何使MultiCheckBox标签加粗或加粗?

Zend framework2 如何使MultiCheckBox标签加粗或加粗?,zend-framework2,zend-form,zend-form-element,zend-form2,Zend Framework2,Zend Form,Zend Form Element,Zend Form2,我有以下多复选框: $this->add(array( 'type' => 'DoctrineModule\Form\Element\ObjectMultiCheckbox', 'name' => 'directPractice', 'options' => array( 'label' => 'A. Check all direct practice field education as

我有以下多复选框:

   $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_属性会使所有标签都加粗,我只希望多框的主标签加粗

'label' => 'A. Check all direct practice field education assignments',
编辑1:将标签属性添加到“选项”


当我按照@itrascastro的建议添加标签属性时,所有标签都变为粗体,我只希望顶部的标签变为粗体:

尝试将此添加到您的选项中:

'options'    => array(
    'label_attributes' => array(
        'class'  => 'myCssBoldClass'
    ),
    // more 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',
],

我添加了一些其他可以定义的值;它们显然是可选的。

因为没有内置选项只为顶部标签执行此操作,所以我使用jQuery来完成此操作:

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

我以前试过。它使所有标签都加粗,我只希望顶部的标签加粗。我编辑了我的问题。是的,但是我怎样才能只把最上面的一个加粗,而把其他的规则化呢?请注意,如果我将其定义为最上面的类,它们都是粗体的:您是否已从主
label\u属性中删除了粗体类?如果您按照我所展示的那样定义它,那么该类应该只应用于
成人
选项。对不起,我想我不清楚。我希望它只适用于这个选项:“A.检查所有直接实践现场教育作业”,我现在明白了。显然,您通常会遵循@itrascastro-answer,但是如果您这样做,看起来属性也会为所有选项显示任何粗体类。这意味着没有现成的方法来做您想要做的事情,您需要扩展类并覆盖
renderOptions
方法来阻止它。如果是这样,那么其他选项将是为每个值定义标签属性,覆盖全局“粗体”效果。