start_controls_section( 'course_title_content', array( 'label' => __('General Settings', 'acadlix-addon-for-elementor') ) ); $this->add_control( 'course_title_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' => 'h1', ) ); $this->add_responsive_control( 'course_title_align', $this->aelms_alignment( array( '{{WRAPPER}}' => 'text-align: {{VALUE}};', ), ) ); $this->end_controls_section(); } protected function register_style_controls() { $selector = '{{WRAPPER}} .aelms-course-title'; $this->start_controls_section( 'course_title_style_section', array( 'label' => __( 'Color & Typography', 'acadlix-addon-for-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ) ); $this->add_control( 'course_title_color', array( 'label' => __( 'Color', 'acadlix-addon-for-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( $selector => 'color: {{VALUE}};', ), 'default' => '#161616', ) ); $this->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'course_title_typography', 'label' => __( 'Typography', 'acadlix-addon-for-elementor' ), 'selector' => $selector, ) ); $this->end_controls_section(); } protected function render() { global $post; $title = __('Course Title', 'acadlix-addon-for-elementor'); $settings = $this->get_settings_for_display(); $saved_tag = $settings['course_title_html_tag']; $tag_name = 'h1'; $options = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'); if (in_array($saved_tag, $options, true)) { $tag_name = $saved_tag; } if ($post->post_type === acadlix()->cpt()->course()->get_post_type()) { $course = acadlix()->model()->course()->ofCourse()->find($post->ID); $title = $course->post_title ?? ""; } echo sprintf( '<%1$s class="aelms-course-title"> ' . esc_html($title) . ' ', esc_attr($tag_name) ); } }