taxonomy = esc_attr( $our_taxonomy ); $tax_args = array( 'hierarchical' => 0, 'taxonomy' => $this->taxonomy, ); $all_taxonomies = get_categories( $tax_args ); $choices = array(); $choices[0] = esc_html__( '— Select —', 'cafeteria-elementor' ); if ( ! empty( $all_taxonomies ) && ! is_wp_error( $all_taxonomies ) ) { foreach ( $all_taxonomies as $tax ) { $choices[ $tax->term_id ] = $tax->name; } } $this->choices = $choices; parent::__construct( $manager, $id, $args ); } /** * Add custom parameters to pass to the JS via JSON. * * @since 1.0.0 */ public function to_json() { parent::to_json(); $this->json['choices'] = $this->choices; $this->json['link'] = $this->get_link(); $this->json['value'] = $this->value(); $this->json['id'] = $this->id; } /** * Enqueue scripts and styles. * * @since 1.0.0 */ public function enqueue() { wp_enqueue_style( 'cafeteria-elementor-customize-controls' ); wp_enqueue_script( 'cafeteria-elementor-customize-controls' ); } /** * Content template. * * @since 1.0.0 */ public function content_template() { ?> json['value'] = ! is_array( $this->value() ) ? explode( ',', $this->value() ) : $this->value(); $this->json['choices'] = $this->choices; $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; } /** * Content template. * * @since 1.0.0 */ public function content_template() { ?> <# if ( ! data.choices ) { return; } #> <# if ( data.label ) { #> {{ data.label }} <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #>