start_controls_section( 'course_author_label', array( 'label' => __('Label', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'course_author_title', [ 'label' => __('Title', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::TEXTAREA, 'default' => __('Created by:', 'acadlix-addon-for-elementor'), 'placeholder' => __('Type your title here', 'acadlix-addon-for-elementor'), 'rows' => 3, ] ); $this->add_control( 'course_author_display_check', array( 'label' => __('Display 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->end_controls_section(); $this->start_controls_section( 'course_author_content', array( 'label' => __('General Settings', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'course_author_link', array( 'label' => __('Link', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::SELECT, 'options' => array( 'new_window' => 'New Window', 'same_window' => 'Same Window', ), 'default' => 'new_window', ) ); $selector = '{{WRAPPER}} .aelms-course-author-container'; $this->add_responsive_control( 'course_author_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( 'course_author_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' => [ 'course_author_display' => 'flex', ], ] ); $this->add_responsive_control( 'course_author_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' => [ 'course_author_display' => 'flex', ], ] ); $this->add_responsive_control( 'course_author_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' => [ 'course_author_display' => 'flex', ], ] ); $this->add_responsive_control( 'course_author_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' => 8, ], 'selectors' => [ "{$selector}" => 'gap: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'course_author_display' => 'flex', ], ] ); $this->end_controls_section(); } protected function register_style_controls() { $title_selector = '{{WRAPPER}} .aelms-course-author-title'; $this->start_controls_section( 'course_author_title_style_section', array( 'label' => __('Title', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_STYLE, ) ); $this->add_responsive_control( 'course_author_title_color', array( 'label' => __('Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => array( $title_selector => 'color: {{VALUE}};', ), 'default' => '#161616', ) ); $this->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'course_author_title_typography', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => $title_selector, ) ); $this->end_controls_section(); $author_selector = '{{WRAPPER}} .aelms-course-author'; $this->start_controls_section( 'course_author_style_section', array( 'label' => __('Author', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_STYLE, ) ); $this->start_controls_tabs('course_author_color_tabs'); $this->start_controls_tab( 'course_author_color_normal_tab', array( 'label' => __('Normal', 'acadlix-addon-for-elementor'), ) ); $this->add_responsive_control( 'course_author_color', array( 'label' => __('Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => array( "{$author_selector} a" => 'color: {{VALUE}};', ), 'default' => '#161616', ) ); $this->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'course_author_typography', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => $author_selector, ) ); $this->end_controls_tab(); $this->start_controls_tab( 'course_author_color_hover_tab', array( 'label' => __('Hover', 'acadlix-addon-for-elementor'), ) ); $this->add_responsive_control( 'course_author_hover_color', array( 'label' => __('Hover', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => array( "{$author_selector} a:hover" => 'color: {{VALUE}};', ), 'default' => '#161616', ) ); $this->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'course_author_typography_hover', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => "{$author_selector} a:hover", ) ); $this->end_controls_tab(); $this->end_controls_tabs(); $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/author.php'; $html = ob_get_clean(); echo wp_kses_post($html); } } }