start_controls_section( 'course_duration_content', [ 'label' => __('General Settings', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'course_duration_title', [ 'label' => __('Title', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::TEXTAREA, 'default' => __('Course Duration:', 'acadlix-addon-for-elementor'), 'placeholder' => __('Type your title here', 'acadlix-addon-for-elementor'), 'rows' => 3, ] ); $selector = '{{WRAPPER}} .aelms-course-duration'; $this->add_responsive_control( 'course_duration_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_duration_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_duration_display' => 'flex', ], ] ); $this->add_responsive_control( 'course_duration_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_duration_display' => 'flex', ], ] ); $this->add_responsive_control( 'course_duration_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_duration_display' => 'flex', ], ] ); $this->add_responsive_control( 'course_duration_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_duration_display' => 'flex', ], ] ); $this->end_controls_section(); } protected function register_style_controls() { $label_selector = '{{WRAPPER}} .aelms-course-duration-label'; $this->start_controls_section( 'course_duration_label_style_section', [ 'label' => __('Label', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'course_duration_label_color', [ 'label' => __('Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ $label_selector => 'color: {{VALUE}};', ], 'default' => '#161616', ] ); $this->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'course_duration_label_typography', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => $label_selector, ) ); $this->end_controls_section(); $text_selector = '{{WRAPPER}} .aelms-course-duration-text'; $this->start_controls_section( 'course_duration_text_style_section', [ 'label' => __('Text', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'course_duration_text_color', [ 'label' => __('Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ $text_selector => 'color: {{VALUE}};', ], 'default' => '#161616', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'course_duration_text_typography', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => $text_selector, ] ); $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/duration.php'; $html = ob_get_clean(); echo wp_kses_post($html); } } }