templates_builder_templates = true; } } /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_script( 'botiga-select2', get_template_directory_uri() . '/assets/vendor/select2/select2.full.min.js', array( 'jquery' ), '4.0.13', true ); wp_enqueue_style( 'botiga-select2', get_template_directory_uri() . '/assets/vendor/select2/select2.min.css', array(), '4.0.13', 'all' ); } /** * Render the control in the customizer */ public function render_content() { $choices = $this->choices; $select2_options = $this->select2_options; $multiple = $this->multiple; $posttype = $this->posttype; if( $posttype ) { $defaults = array( 'post_type' => 'page', 'posts_per_page' => -1, ); $args = wp_parse_args( $this->posttype_args, $defaults ); $choices = array(); if( isset( $this->posttype_empty_first_value ) ) { $choices[''] = $this->posttype_empty_first_value; } $posts = get_posts( $args ); foreach( $posts as $post ) { $choices[$post->ID] = $post->post_title; } } if( $this->templates_builder_templates ) { $choices = array(); $templates = get_option( 'botiga_template_builder_data' ); $choices[''] = esc_html__( 'None', 'botiga' ); if ( ! empty( $templates ) ) { $templates = array_filter( $templates, function( $item ) { return 'global' !== $item[ 'id' ]; } ); foreach( $templates as $template ) { $template_id = $template[ 'content' ]; $choices[ $template_id ] = $template[ 'template_name' ]; } } } ?>