/** * Registers the setting in the Post Meta Manager * * @param G1_Post_Meta_Manager $manager */ public function register_individual_setting($manager) { // Get post types with support for required feature $post_types = $this->get_post_types(array($this->global_feature, G1_Single_Entry_Settings_Feature()->get_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($post_types)) { $setting_id = '_g1[' . $this->get_individual_setting_id() . ']'; $manager->add_setting($setting_id, array('apply' => $post_types, 'view' => new G1_Form_Image_Choice_Control($setting_id, array('label' => __('Template', 'g1_theme'), 'choices' => $choices)), 'section' => G1_Single_Entry_Settings_Feature()->get_section_id(), 'priority' => 190)); } }
public function register_entry_element($manager) { $post_types = $this->get_post_types(); foreach ($post_types as $post_type) { if (!post_type_supports($post_type, G1_Single_Entry_Settings_Feature()->get_feature())) { unset($post_types[$post_type]); } } if (count($post_types)) { $setting_id = '_g1[' . $this->get_individual_setting_id() . ']'; // Add the empty choice $choices = $this->get_choices(); $choices = array('' => __('inherit', 'g1_theme')) + $choices; $manager->add_setting($setting_id, array('apply' => $post_types, 'view' => new G1_Form_Choice_Control($setting_id, array('label' => $this->get_label(), 'hint' => $this->get_hint(), 'help' => $this->get_help(), 'choices' => $choices)), 'section' => G1_Single_Entry_Settings_Feature()->get_section_id(), 'priority' => $this->get_priority())); } }