start_controls_section( 'course_action_content', [ 'label' => __('General Settings', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'course_go_to_course_text', [ 'label' => __('Go to Course Text', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::TEXTAREA, 'default' => __('Go to Course', 'acadlix-addon-for-elementor'), 'placeholder' => __('Type your text here', 'acadlix-addon-for-elementor'), 'rows' => 2, ] ); $this->add_control( 'course_go_to_checkout_text', [ 'label' => __('Go to Checkout Text', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::TEXTAREA, 'default' => __('Go to Checkout', 'acadlix-addon-for-elementor'), 'placeholder' => __('Type your text here', 'acadlix-addon-for-elementor'), 'rows' => 2, ] ); $this->add_control( 'course_start_now_text', [ 'label' => __('Start Now Text', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::TEXTAREA, 'default' => __('Start Now', 'acadlix-addon-for-elementor'), 'placeholder' => __('Type your text here', 'acadlix-addon-for-elementor'), 'rows' => 2, ] ); $this->add_control( 'course_buy_now_text', [ 'label' => __('Buy Now Text', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::TEXTAREA, 'default' => __('Buy Now', 'acadlix-addon-for-elementor'), 'placeholder' => __('Type your text here', 'acadlix-addon-for-elementor'), 'rows' => 2, ] ); $this->add_control( 'course_subscribe_now_text', [ 'label' => __('Subscribe Now Text', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::TEXTAREA, 'default' => __('Subscribe Now', 'acadlix-addon-for-elementor'), 'placeholder' => __('Type your text here', 'acadlix-addon-for-elementor'), 'rows' => 2, ] ); $this->end_controls_section(); $this->start_controls_section( 'course_button_settings', [ 'label' => __('Button Settings', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $selector = '{{WRAPPER}} .acadlix-course-action-buttons'; $this->add_responsive_control( 'course_button_settings_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_button_settings_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_button_settings_display' => 'flex', ], ] ); $this->add_responsive_control( 'course_button_settings_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' => 'center', 'condition' => [ 'course_button_settings_display' => 'flex', ], ] ); $this->add_responsive_control( 'course_button_settings_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_button_settings_display' => 'flex', ], ] ); $this->add_responsive_control( 'course_button_settings_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' => [ 'course_button_settings_display' => 'flex', ], ] ); $this->end_controls_section(); } protected function register_style_controls() { $this->start_controls_section( 'course_action_style_section', [ 'label' => __('Button', 'acadlix-addon-for-elementor'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'course_action_style_tabs' ); $this->start_controls_tab( 'course_action_style_normal', [ 'label' => __('Normal', 'acadlix-addon-for-elementor'), ] ); $this->add_responsive_control( 'course_action_color', [ 'label' => __('Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .aelms-course-action' => 'color: {{VALUE}};', ], 'default' => '#fff', ] ); $this->add_responsive_control( 'course_action_background_color', [ 'label' => __('Background Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .aelms-course-action' => 'background-color: {{VALUE}};', ], 'default' => '#0073e6', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'course_action_typography', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => '{{WRAPPER}} .aelms-course-action', 'fields_options' => [ 'typography' => [ 'default' => 'yes' ], 'font_size' => [ 'default' => [ 'unit' => 'px', 'size' => 14, ], ], 'font_weight' => [ 'default' => 500 ], ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'course_action_style_hover', [ 'label' => __('Hover', 'acadlix-addon-for-elementor'), ] ); $this->add_responsive_control( 'course_action_hover_color', [ 'label' => __('Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .aelms-course-action:hover' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'course_action_hover_background_color', [ 'label' => __('Background Color', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .aelms-course-action:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'course_action_hover_typography', 'label' => __('Typography', 'acadlix-addon-for-elementor'), 'selector' => '{{WRAPPER}} .aelms-course-action:hover', 'fields_options' => [ 'typography' => [ 'default' => 'yes' ], 'font_size' => [ 'default' => [ 'unit' => 'px', 'size' => 14, ], ], 'font_weight' => [ 'default' => 500 ], ], ] ); $this->end_controls_tabs(); $this->add_control( 'course_action_button_divider', [ 'type' => Controls_Manager::DIVIDER, ] ); $this->add_responsive_control( 'course_action_padding', [ 'label' => __('Padding', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%', 'em'], 'selectors' => [ '{{WRAPPER}} .aelms-course-action' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'default' => [ 'unit' => 'px', 'top' => 8, 'right' => 8, 'bottom' => 8, 'left' => 8, ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'course_action_border', 'label' => __('Border', 'acadlix-addon-for-elementor'), 'selector' => "{{WRAPPER}} .aelms-course-action", ] ); $this->add_responsive_control( 'course_action_border_radius', [ 'label' => __('Border Radius', 'acadlix-addon-for-elementor'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'selectors' => [ "{{WRAPPER}} .aelms-course-action" => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'default' => [ 'top' => 6, 'right' => 6, 'bottom' => 6, 'left' => 6, 'unit' => 'px', 'isLinked' => true ], ] ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'course_action_box_shadow', 'label' => __('Box Shadow', 'acadlix-addon-for-elementor'), 'selector' => "{{WRAPPER}} .aelms-course-action", ] ); $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/action.php'; $html = ob_get_clean(); echo wp_kses_post($html); } } }