start_controls_section( 'single_course_rating_content', [ 'label' => __('General Settings', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $selector = '{{WRAPPER}} .aelms-single-course-rating'; $this->add_responsive_control( 'single_course_rating_display', [ 'label' => __('Display', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SELECT, 'options' => [ 'block' => __('Block', 'acadlix-addon-for-elementor'), 'flex' => __('Flex', 'acadlix-addon-for-elementor'), ], 'selectors' => [ $selector => 'display: {{VALUE}};', ], 'default' => 'flex', ] ); $this->add_responsive_control( 'single_course_rating_flex_direction', [ 'label' => __('Flex Direction', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SELECT, 'options' => [ 'row' => __('Row', 'acadlix-addon-for-elementor'), 'row-reverse' => __('Row Reverse', 'acadlix-addon-for-elementor'), 'column' => __('Column', 'acadlix-addon-for-elementor'), 'column-reverse' => __('Column Reverse', 'acadlix-addon-for-elementor'), ], 'selectors' => [ $selector => 'flex-direction: {{VALUE}};', ], 'default' => 'row', 'condition' => [ 'single_course_rating_display' => 'flex', ], ] ); $this->add_responsive_control( 'single_course_rating_justify_content', [ 'label' => __('Justify Content', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SELECT, 'options' => [ 'flex-start' => __('Flex Start', 'acadlix-addon-for-elementor'), 'flex-end' => __('Flex End', 'acadlix-addon-for-elementor'), 'center' => __('Center', 'acadlix-addon-for-elementor'), 'space-between' => __('Space Between', 'acadlix-addon-for-elementor'), 'space-around' => __('Space Around', 'acadlix-addon-for-elementor'), 'space-evenly' => __('Space Evenly', 'acadlix-addon-for-elementor'), 'stretch' => __('Stretch', 'acadlix-addon-for-elementor'), ], 'selectors' => [ $selector => 'justify-content: {{VALUE}};', ], 'default' => 'flex-start', 'condition' => [ 'single_course_rating_display' => 'flex', ], ] ); $this->add_responsive_control( 'single_course_rating_align_items', [ 'label' => __('Align Items', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SELECT, 'options' => [ 'flex-start' => __('Flex Start', 'acadlix-addon-for-elementor'), 'flex-end' => __('Flex End', 'acadlix-addon-for-elementor'), 'center' => __('Center', 'acadlix-addon-for-elementor'), 'baseline' => __('Baseline', 'acadlix-addon-for-elementor'), 'stretch' => __('Stretch', 'acadlix-addon-for-elementor'), ], 'selectors' => [ $selector => 'align-items: {{VALUE}};', ], 'default' => 'center', 'condition' => [ 'single_course_rating_display' => 'flex', ], ] ); $this->add_responsive_control( 'single_course_rating_gap', [ 'label' => __('Gap', 'acadlix-addon-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => ['px', '%', 'em', 'rem', 'custom'], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => 2, ], 'selectors' => [ "{$selector}" => 'gap: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'single_course_rating_display' => 'flex', ], ] ); $this->end_controls_section(); } protected function register_style_controls() { // No additional style controls for now $rating = '{{WRAPPER}} .aelms-single-course-rating'; $rating_icon = '{{WRAPPER}} .aelms-single-course-rating-stars i'; $rating_value = '{{WRAPPER}} .aelms-single-course-rating-value'; $this->start_controls_section( 'single_course_layout_style', [ 'label' => __('Layout', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'single_course_content_rating_icon_color', array( 'label' => __('Icon Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => array( $rating_icon => 'color: {{VALUE}}' ), 'default' => '#ed9700', ) ); $this->add_responsive_control( 'single_course_rating_icon_size', array( 'label' => __('Icon Size', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SLIDER, 'size_units' => array('px'), 'range' => array( 'px' => array( 'min' => 5, 'max' => 100, ), ), 'default' => array( 'unit' => 'px', 'size' => 16, ), 'selectors' => array( $rating_icon => 'font-size: {{SIZE}}{{UNIT}};', ), ) ); $this->add_control( 'single_course_content_rating_value_color', array( 'label' => __('Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => array( $rating_value => 'color: {{VALUE}}' ), 'default' => '#161616', ) ); $this->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'single_course_content_rating_value_typography', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => $rating_value, ) ); $this->add_control( 'single_course_content_rating_padding', array( 'label' => __('Padding', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array('px', '%'), 'selectors' => array( "{$rating}" => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ) ); $this->end_controls_section(); } protected function render() { $course = aelms_get_course(); if ($course) { $settings = $this->get_settings_for_display(); include AELMS_PLUGIN_DIR . 'templates/course/rating.php'; $html = ob_get_clean(); echo wp_kses_post($html); } } }