示例#1
0
 /**
  * Create the sidebar management metabox fields container.
  *
  * @param string $post_type The post type.
  * @return void
  */
 function thb_sidebars_metabox_container($post_type = null)
 {
     $thb_container = new THB_MetaboxFieldsContainer(__('Page sidebar', 'thb_text_domain'), 'sidebar_config');
     $field = new THB_SelectField('sidebar');
     $field->setLabel(__('Sidebar to display', 'thb_text_domain'));
     $field->setOptions(array(0 => __('No sidebar', 'thb_text_domain')));
     $field->setDynamicOptions('thb_get_sidebars_for_select');
     if ($post_type) {
         $field->setDynamicDefault('thb_get_post_type_sidebar', $post_type);
     }
     $thb_container->addField($field);
     $field = new THB_SelectField('sidebar_position');
     $field->setLabel(__('Position', 'thb_text_domain'));
     $field->setOptions(array('sidebar-right' => __('Right', 'thb_text_domain'), 'sidebar-left' => __('Left', 'thb_text_domain')));
     $thb_container->addField($field);
     return $thb_container;
 }