0

我有以下多选框:

   $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 使所有标签变为粗体,我只希望 multibox 的主标签为粗体。

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

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

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

4

3 回答 3

0

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

'options'    => array(
    'label_attributes' => array(
        'class'  => 'myCssBoldClass'
    ),
    // more options
),
于 2015-03-02T11:51:48.853 回答
0

每个值选项都接受一组选项

例如

'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',
],

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

于 2015-03-03T00:08:43.207 回答
0

由于没有内置选项可以仅针对顶部标签执行此操作,因此我使用 jQuery 来完成此操作:

$("label[for]").each(function(){
    $(this).addClass("label-bold");
});
于 2015-03-09T22:41:15.670 回答