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 を使用すると、すべてのラベルが太字になり、マルチボックスのメイン ラベルだけを太字にしたい。

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

編集 1: label_attributes を「オプション」に追加

@itrascastro が提案したように label_attributes を追加すると、すべてのラベルが太字になり、一番上のラベルだけを太字にしたい: multicheckbox

4

3 に答える 3

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 に答える