start_controls_section( 'course_target_audience_general_settings', array( 'label' => __('General Settings', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'course_target_audience_html_tag', array( 'label' => esc_html__('Select Tag', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SELECT, 'options' => array( 'h1' => esc_html('h1'), 'h2' => esc_html('h2'), 'h3' => esc_html('h3'), 'h4' => esc_html('h4'), 'h5' => esc_html('h5'), 'h6' => esc_html('h6'), ), 'default' => 'h2', ) ); $this->add_control( 'course_target_audience_title', array( 'label' => __('Title', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::TEXTAREA, 'default' => __('Target Audience', 'acadlix-addon-for-elementor'), 'placeholder' => __('Type your title here', 'acadlix-addon-for-elementor'), 'rows' => 3, ) ); $this->add_control( 'course_target_audience_title_display', array( 'label' => __('Show Title', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SWITCHER, 'label_on' => __('Show', 'acadlix-addon-for-elementor'), 'label_off' => __('Hide', 'acadlix-addon-for-elementor'), 'return_value' => 'yes', 'default' => 'yes', ) ); $this->add_responsive_control( 'course_target_audience_align', $this->aelms_alignment( array( '{{WRAPPER}}' => 'text-align: {{VALUE}};', ), ) ); $this->add_control( 'course_target_audience_label_divider', [ 'type' => Controls_Manager::DIVIDER, ] ); $this->add_responsive_control( 'course_target_audience_display_type', [ 'label' => __('Display', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SELECT, 'options' => [ 'block' => __('Block View', 'acadlix-addon-for-elementor'), 'grid' => __('Grid View', 'acadlix-addon-for-elementor'), ], 'default' => 'grid', 'selectors_dictionary' => [ 'block' => 'display: block; --aelms-course-target-audience-item-width: 100%;', 'grid' => 'display: flex; flex-wrap: wrap; --aelms-course-target-audience-item-width: 50%;', ], 'selectors' => [ '{{WRAPPER}} .aelms-course-target-audience' => '{{VALUE}}', '{{WRAPPER}} .aelms-course-target-audience-item' => 'width: var(--aelms-course-target-audience-item-width, 50%);', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'course_target_audience_icon_settings', array( 'label' => __('Icon Settings', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'course_target_audience_list_icon', [ 'label' => __('Add Icon', 'acadlix-addon-for-elementor'), 'type' => \Elementor\Controls_Manager::ICONS, 'default' => [ 'value' => 'fas fa-check-circle', 'library' => 'fa-solid', ], ] ); $this->end_controls_section(); } protected function register_style_controls() { $label_selector = '{{WRAPPER}} .aelms-course-target-audience-title'; $this->start_controls_section( 'course_target_audience_label_style_section', array( 'label' => __('Label', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_STYLE, ) ); $this->add_responsive_control( 'course_target_audience_label_color', array( 'label' => __('Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => array( $label_selector => 'color: {{VALUE}};', ), 'default' => '#161616', ) ); $this->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'course_target_audience_label_typography', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => $label_selector, ) ); $this->add_responsive_control( 'course_target_audience_label_gap', array( 'label' => __('Gap', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SLIDER, 'size_units' => array('px'), 'range' => array( 'px' => array( 'min' => -100, 'max' => 100, ), ), 'selectors' => array( $label_selector => 'margin-bottom: {{SIZE}}{{UNIT}};', ), ) ); $this->end_controls_section(); $target_audience_item_icon = '{{WRAPPER}} .aelms-course-target-audience-item-icon'; $this->start_controls_section( 'course_target_audience_list_icon_style_section', array( 'label' => __('Icon', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_STYLE, ) ); $this->add_responsive_control( 'course_target_audience_list_icon_color', array( 'label' => __('Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => array( "{$target_audience_item_icon}" => 'color: {{VALUE}};', ), 'default' => '#161616', ) ); $this->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'course_target_audience_list_icon_typography', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => "{$target_audience_item_icon}", ) ); $this->end_controls_section(); $target_audience_item_text = '{{WRAPPER}} .aelms-course-target-audience-item-text'; $this->start_controls_section( 'course_target_audience_list_text_style_section', array( 'label' => __('List', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_STYLE, ) ); $this->add_responsive_control( 'course_target_audience_list_text_color', array( 'label' => __('Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => array( "{$target_audience_item_text}" => 'color: {{VALUE}};', ), 'default' => '#161616', ) ); $this->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'course_target_audience_list_text_typography', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => "{$target_audience_item_text}", ) ); $this->end_controls_section(); $this->start_controls_section( 'course_target_audience_style_section', array( 'label' => __('General Settings', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_STYLE, ) ); $this->add_responsive_control( 'course_target_audience_icon_text_gap', array( 'label' => __('Icon Text Gap', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SLIDER, 'size_units' => array('px'), 'range' => array( 'px' => array( 'min' => 0, 'max' => 100, ), ), 'default' => array( 'unit' => 'px', 'size' => 1, ), 'selectors' => array( '{{WRAPPER}} .aelms-course-target-audience-item' => 'gap: {{SIZE}}{{UNIT}};', ), ) ); $this->add_responsive_control( 'course_target_audience_padding', array( 'label' => __('Target Audience Padding', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array('px', 'em', '%'), 'selectors' => array( '{{WRAPPER}} .aelms-course-target-audience-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), 'default' => array( 'top' => 0, 'right' => 0, 'bottom' => 0, 'left' => 0, 'unit' => 'px', 'isLinked' => true, ), ) ); $this->end_controls_section(); } protected function render() { $course = aelms_get_course(); if ($course) { ob_start(); $settings = $this->get_settings_for_display(); include AELMS_PLUGIN_DIR . 'templates/course/target-audience.php'; $html = ob_get_clean(); echo wp_kses_post($html); } } }