register_jet_control_group( 'section_stars_style', [ 'title' => esc_html__( 'Stars', 'jet-smart-filters' ), 'tab' => 'style', ] ); } public function register_filter_style_controls() { $css_scheme = apply_filters( 'jet-smart-filters/widgets/rating/css-scheme', array( 'filter-rating-stars' => '.jet-rating-stars', 'filter-rating-icon' => '.jet-rating-star__icon', 'filter' => '.jet-filter', 'filter-control' => '.jet-rating__control', 'filters-label' => '.jet-filter-label', 'apply-filters' => '.apply-filters', 'apply-filters-button' => '.apply-filters__button', ) ); $this->start_jet_control_group( 'section_stars_style' ); $this->register_jet_control( 'stars_size', [ 'tab' => 'style', 'label' => esc_html__( 'Size', 'jet-smart-filters' ), 'type' => 'number', 'units' => true, 'css' => [ [ 'property' => 'font-size', 'selector' => $css_scheme['filter-rating-icon'], ], ], ] ); $this->register_jet_control( 'stars_gutter', [ 'tab' => 'style', 'label' => esc_html__( 'Gutter', 'jet-smart-filters' ), 'type' => 'number', 'units' => true, 'css' => [ [ 'property' => 'margin-left', 'selector' => $css_scheme['filter-rating-icon'], ], ], ] ); $this->register_jet_control( 'stars_color', [ 'tab' => 'style', 'label' => esc_html__( 'Color', 'jet-smart-filters' ), 'type' => 'color', 'css' => [ [ 'property' => '--rating-color', ], ], ] ); $this->register_jet_control( 'stars_selected_color', [ 'tab' => 'style', 'label' => esc_html__( 'Selected color', 'jet-smart-filters' ), 'type' => 'color', 'css' => [ [ 'property' => '--rating-selected-color', ], ], ] ); $this->register_jet_control( 'stars_color_second', [ 'tab' => 'style', 'label' => esc_html__( 'Selected hover color', 'jet-smart-filters' ), 'type' => 'color', 'css' => [ [ 'property' => '--rating-hover-color', ], ], ] ); $this->register_jet_control( 'stars_margin', [ 'tab' => 'style', 'label' => esc_html__( 'Margin', 'jet-smart-filters' ), 'type' => 'dimensions', 'css' => [ [ 'property' => 'margin', 'selector' => $css_scheme['filter-rating-stars'], ], ], ] ); $this->register_jet_control( 'stars_alignment', [ 'tab' => 'style', 'label' => esc_html__( 'Alignment', 'jet-smart-filters' ), 'type' => 'text-align', 'exclude' => [ 'justify', ], 'css' => [ [ 'property' => 'text-align', 'selector' => $css_scheme['filter-control'], ], ], ] ); $this->end_jet_control_group(); } // Render element HTML public function render() { jet_smart_filters()->set_filters_used(); $base_class = $this->name; $settings = $this->parse_jet_render_attributes( $this->get_jet_settings() ); $filter_id = ! empty( $settings['filter_id'] ) ? $settings['filter_id'] : ''; // STEP: Select filter is empty: Show placeholder text if ( empty( $filter_id ) ) { return $this->render_element_placeholder( [ 'title' => esc_html__( 'Please select filter to show.', 'jet-smart-filters' ) ] ); } $filter_id = apply_filters( 'jet-smart-filters/render_filter_template/filter_id', $filter_id ); echo "