Exemplo n.º 1
0
 /**
  * Registers the setting in the Term Meta Manager
  *
  * @param G1_Term_Meta_Manager $manager
  */
 public function register_individual_term_setting($manager)
 {
     // Get post types with support for required feature
     $taxonomies = $this->get_taxonomies(array($this->individual_feature));
     $choices = $this->get_template_manager()->get_templates_choices();
     $empty = trailingslashit(get_template_directory_uri()) . 'images/admin-assets/inherit.png';
     $choices = array('' => $empty) + $choices;
     if (count($taxonomies)) {
         $setting_id = '_g1[' . $this->get_individual_setting_id() . ']';
         $manager->add_setting($setting_id, array('apply' => $taxonomies, 'view' => new G1_Form_Image_Choice_Control($setting_id, array('label' => __('Template', 'g1_theme'), 'choices' => $choices)), 'section' => 'g1_term_single', 'priority' => 190));
         $setting_id = '_g1[' . $this->get_individual_setting_id() . '_sidebar_1]';
         $manager->add_setting($setting_id, array('apply' => $taxonomies, 'view' => new G1_Form_Choice_Control($setting_id, array('label' => __('Sidebar', 'g1_theme'), 'choices' => array_merge(array('' => 'inherit'), g1_sidebar_get_choices()))), 'section' => 'g1_term_single', 'priority' => 192));
         $setting_id = '_g1[' . $this->get_individual_setting_id() . '_effect]';
         $manager->add_setting($setting_id, array('apply' => $taxonomies, 'view' => new G1_Form_Choice_Control($setting_id, array('label' => __('Effect', 'g1_theme'), 'choices' => array('' => __('inherit', 'g1_theme'), 'none' => __('none', 'g1_theme'), 'grayscale' => __('grayscale', 'g1_theme')))), 'section' => 'g1_term_single', 'priority' => 195));
     }
 }
Exemplo n.º 2
0
 /**
  *
  *
  * @param G1_Term_Meta_Manager $manager
  */
 public function register_individual_term_setting($manager)
 {
     $taxonomies = $this->get_taxonomies('g1-collection-individual-elements');
     foreach ($taxonomies as $key => $taxonomy) {
         $taxonomy_obj = get_taxonomy($taxonomy);
         if (!$taxonomy_obj) {
             unset($taxonomies[$key]);
             continue;
         }
         if (!count(array_intersect($this->get_post_types(), $taxonomy_obj->object_type))) {
             unset($taxonomies[$key]);
             continue;
         }
     }
     if (count($taxonomies)) {
         $setting_id = str_replace('-', '_', $this->get_id());
         $setting_id = '_g1[element_' . $setting_id . ']';
         $choices = $this->get_choices();
         $choices = array('' => __('inherit', 'g1_theme')) + $choices;
         $manager->add_setting($setting_id, array('apply' => $taxonomies, 'view' => new G1_Form_Choice_Control($setting_id, array('label' => $this->get_label(), 'choices' => $choices)), 'section' => 'g1_term_single', 'priority' => $this->get_priority()));
     }
 }