function sw_optionsClass() { // Fetch the Options Array - This is the sw_options filter hook global $sw_options; $sw_options = apply_filters('sw_options', $sw_options); // Initiate the Options Class with the config settings in the array $options_panel = new BF_Admin_Page_Class($sw_options['config']); // Open the Options Tabs Container $options_panel->OpenTabs_container(''); // Execute the list of options tabs $options_panel->TabsListing($sw_options['tabs']); // Loop through the options tabs and build the options page foreach ($sw_options['options'] as $tabName => $tabOptions) { $options_panel->OpenTab($tabName); // Loop through and output the options for this tab foreach ($tabOptions as $key => $option) { // TITLE - Add a Title if ($option['type'] == 'title') { $options_panel->Title($option['content']); } // PARAGRAPH - Add a Paragraph of Information if ($option['type'] == 'paragraph') { $options_panel->addParagraph($option['content']); } // TEXTBOX - Add a Textbox option if ($option['type'] == 'textbox') { if (isset($option['default'])) { $options_panel->addText($key, array('name' => $option['content'], 'std' => $option['default'])); } else { $options_panel->addText($key, array('name' => $option['content'])); } } // CHECKBOX - Add a checkbox option if ($option['type'] == 'checkbox') { $options_panel->addCheckbox($key, array('name' => $option['content'], $key => $key, 'std' => $option['default'])); } // SORTABLE - Add a sortable option if ($option['type'] == 'sortable') { $options_panel->addSortable($key, $option['content'], array('name' => $option['name'])); } // SELECT - Add a select option if ($option['type'] == 'select') { $options_panel->addSelect($key, $option['content'], array('name' => $option['name'], 'std' => $option['default'])); } // COLOROPTION - Add a color picker if ($option['type'] == 'colorselect') { $options_panel->addColor($key, array('name' => $option['name'], 'std' => $option['default'])); } } // Close the tab and move on to the next one $options_panel->CloseTab(); } }
//posts checkbox field $options_panel->addPosts('posts2_field_id', array('post_type' => 'post', 'type' => 'checkbox_list'), array('name' => __('My Posts Checkboxes', 'apc'), 'class' => 'no-toggle', 'desc' => __('This field has a <pre>.no-toggle</pre> class which disables the fancy Iphone like toggle', 'apc'))); //Roles checkbox field $options_panel->addRoles('roles2_field_id', array('type' => 'checkbox_list'), array('name' => __('My Roles Checkboxes', 'apc'), 'desc' => __('roles checboxes field description', 'apc'))); /** * Close 4th tab */ $options_panel->CloseTab(); /** * Open admin page 5th tab */ $options_panel->OpenTab('options_5'); //title $options_panel->Title(__("Advanced Options", "apc")); //sortable field $options_panel->addSortable('sortable_field_id', array('1' => 'One', '2' => 'Two', '3' => 'three', '4' => 'four'), array('name' => __('My Sortable Field', 'apc'), 'desc' => __('Sortable field description', 'apc'))); /* * To Create a reapeater Block first create an array of fields * use the same functions as above but add true as a last param */ $repeater_fields[] = $options_panel->addText('re_text_field_id', array('name' => __('My Text ', 'apc')), true); $repeater_fields[] = $options_panel->addTextarea('re_textarea_field_id', array('name' => __('My Textarea ', 'apc')), true); $repeater_fields[] = $options_panel->addImage('image_field_id', array('name' => __('My Image ', 'apc')), true); $repeater_fields[] = $options_panel->addCheckbox('checkbox_field_id', array('name' => __('My Checkbox ', 'apc')), true); /* * Then just add the fields to the repeater block */ //repeater block $options_panel->addRepeaterBlock('re_', array('sortable' => true, 'inline' => true, 'name' => __('This is a Repeater Block', 'apc'), 'fields' => $repeater_fields, 'desc' => __('Repeater field description', 'apc'))); /** * To Create a Conditional Block first create an array of fields (just like a repeater block