APF_Demo_BuiltinFieldTypes_Selector_Checkbox::__construct PHP Метод

__construct() публичный Метод

Sets up a form section.
public __construct ( $oFactory )
    public function __construct($oFactory)
    {
        // Section
        $oFactory->addSettingSections($this->sPageSlug, array('section_id' => $this->sSectionID, 'tab_slug' => $this->sTabSlug, 'title' => __('Check-boxes', 'admin-page-framework-loader'), 'tip' => __('These are check boxes.', 'admin-page-framework-loader')));
        // Fields
        $oFactory->addSettingFields($this->sSectionID, array('field_id' => 'checkbox', 'title' => __('Checkbox', 'admin-page-framework-loader'), 'tip' => __('For a single check box item, set a string to the <code>label</code> argument.', 'admin-page-framework-loader'), 'type' => 'checkbox', 'label' => __('This is a check box.', 'admin-page-framework-loader') . ' ' . __('A string can be passed to the <code>label</code> argument for a single item.', 'admin-page-framework-loader'), 'default' => false, 'description' => array("<pre class='field-argument-example'>" . $oFactory->oWPRMParser->getSyntaxHighlightedPHPCode(<<<EOD
array(
    'type'      => 'checkbox',
    'label'     => 'This is a check box...',
    'default'   => false,
)
EOD
) . "</pre>")), array('field_id' => 'checkbox_multiple_items', 'title' => __('Multiple', 'admin-page-framework-loader'), 'type' => 'checkbox', 'label' => array('moon' => 'Moon', 'earth' => 'Earth (this option is disabled)', 'sun' => 'Sun', 'mars' => 'Mars'), 'default' => array('moon' => true, 'earth' => false, 'sun' => true, 'mars' => false), 'attributes' => array('earth' => array('disabled' => 'disabled')), 'label_min_width' => '100%', 'tip' => __('With the <code>attributes</code> argument, check box items can be disabled.', 'admin-page-framework-loader'), 'description' => array(__('For for multiple checkbox items, set an array to the <code>label</code> argument.', 'admin-page-framework-loader'), __('It is possible to disable checkbox items on an individual basis.', 'admin-page-framework-loader'), "<pre class='field-argument-example'>" . $oFactory->oWPRMParser->getSyntaxHighlightedPHPCode(<<<EOD
    'type'          => 'checkbox',
    'label'         => array( 
        'moon'  => __( 'Moon', 'admin-page-framework-loader' ),
        'earth' => __( 'Earth', 'admin-page-framework-loader' ) . ' (' . __( 'this option is disabled.', 'admin-page-framework-loader' ) . ')',
        'sun'   => __( 'Sun', 'admin-page-framework-loader' ),
        'mars'  => __( 'Mars', 'admin-page-framework-loader' ),
    ),
    'default'       => array( 
        'moon'  => true, 
        'earth' => false, 
        'sun'   => true, 
        'mars'  => false,
    ),
EOD
) . "</pre>")), array('field_id' => 'checkbox_multiple_fields', 'title' => __('Multiple Sets', 'admin-page-framework-loader'), 'type' => 'checkbox', 'select_all_button' => true, 'select_none_button' => true, 'label' => array('a' => 'A', 'b' => 'B', 'c' => 'C'), 'default' => array('a' => false, 'b' => true, 'c' => false), 'delimiter' => '<hr />', 'attributes' => array('field' => array('style' => 'width: 100%;')), array('label' => array('d' => 'D', 'e' => 'E', 'f' => 'F'), 'default' => array('d' => true, 'e' => false, 'f' => false)), array('label' => array('g' => 'G', 'h' => 'H', 'i' => 'I'), 'default' => array('g' => false, 'h' => false, 'i' => true)), 'tip' => __('To create multiple fields for one field ID, you can use the numeric keys in the field definition array.', 'admin-page-framework-loader'), 'description' => array("<pre class='field-argument-example'>" . $oFactory->oWPRMParser->getSyntaxHighlightedPHPCode(<<<EOD
    'type'                  => 'checkbox',
    'label'                 => array( 
        'a' => 'A',
        'b' => 'B',
        'c' => 'C' 
    ),
    'default'               => array( 
        'a' => false,
        'b' => true,
        'c' => false 
    ),
    array(
        'label' => array(
            'd' => 'D',
            'e' => 'E',
            'f' => 'F' 
        ),
        'default' => array(
            'd' => true,
            'e' => false,
            'f' => false 
        ),
    ),
    array(
        'label' => array(
            'g' => 'G',
            'h' => 'H',
            'i' => 'I'
        ),
        'default' => array(
            'g' => false,
            'h' => false,
            'i' => true 
        ),
    ),
EOD
) . "</pre>")), array('field_id' => 'checkbox_repeatable_fields', 'title' => __('Repeatable', 'admin-page-framework-loader'), 'type' => 'checkbox', 'label' => array('x', 'y', 'z'), 'repeatable' => true, 'select_all_button' => __('Check All', 'admin-page-framework-loader'), 'select_none_button' => __('Uncheck All', 'admin=page-framework-demo'), 'description' => array("<pre class='field-argument-example'>" . $oFactory->oWPRMParser->getSyntaxHighlightedPHPCode(<<<EOD
    'type'               => 'checkbox',
    'label'              => array( 'x', 'y', 'z' ),
    'repeatable'         => true,
    'select_all_button'  => 'Check All',
    'select_none_button' => 'Uncheck All',
EOD
) . "</pre>")), array('field_id' => 'checkbox_sortable_fields', 'title' => __('Sortable', 'admin-page-framework-loader'), 'type' => 'checkbox', 'label' => array('x', 'y', 'z'), 'sortable' => true, array(), array(), array(), 'description' => array("<pre class='field-argument-example'>" . $oFactory->oWPRMParser->getSyntaxHighlightedPHPCode(<<<EOD
    'type'          => 'checkbox',
    'label'         => array( 'x', 'y', 'z' ),
    'sortable'      => true,
    array(), // the second item
    array(), // the third item
    array(), // the fourth item
EOD
) . "</pre>")));
    }
APF_Demo_BuiltinFieldTypes_Selector_Checkbox