add_control( $name, [ 'label' => $label, 'type' => Controls_Manager::SELECT, 'default' => $shown, 'options' => [ $shown => __( 'Show', 'academy-elementor-addons' ), 'none' => __( 'Hide', 'academy-elementor-addons' ), ], 'selectors' => [ '{{WRAPPER}} ' . $selector => 'display: {{VALUE}};' ], ] ); } private function color( $name, $label, $selector, $property = 'color' ) { $this->add_control( $name, [ 'label' => $label, 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} ' . $selector => $property . ': {{VALUE}};' ], ] ); } private function typography( $name, $label, $selector ) { $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => $name, 'label' => $label, 'selector' => '{{WRAPPER}} ' . $selector, ] ); } private function dimension( $name, $label, $selector, $property ) { $this->add_responsive_control( $name, [ 'label' => $label, 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', 'rem', '%' ], 'selectors' => [ '{{WRAPPER}} ' . $selector => $property . ': {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); } private function slider( $name, $label, $selector, $property, $max = 100, $units = [ 'px' ] ) { $this->add_responsive_control( $name, [ 'label' => $label, 'type' => Controls_Manager::SLIDER, 'size_units' => $units, 'range' => [ 'px' => [ 'min' => 0, 'max' => $max ], '%' => [ 'min' => 0, 'max' => 100 ], ], 'selectors' => [ '{{WRAPPER}} ' . $selector => $property . ': {{SIZE}}{{UNIT}};' ], ] ); } protected function register_controls() { $this->start_controls_section( 'curriculum_top_logo_content', [ 'label' => __( 'Back to Course', 'academy-elementor-addons' ), ] ); $this->visibility( 'curriculum_top_show_logo', __( 'Show Back Arrow', 'academy-elementor-addons' ), '.academy-lesson-breadcrumb__back' ); $this->visibility( 'curriculum_top_show_back_text', __( 'Show Back Text', 'academy-elementor-addons' ), '.academy-lesson-breadcrumb__text small' ); $this->end_controls_section(); $this->start_controls_section( 'curriculum_top_title_content', [ 'label' => __( 'Course Title', 'academy-elementor-addons' ), ] ); $this->visibility( 'curriculum_top_show_title', __( 'Show Course Title', 'academy-elementor-addons' ), '.academy-lesson-breadcrumb__text b' ); $this->visibility( 'curriculum_top_show_curriculum_button', __( 'Show Course Content Button', 'academy-elementor-addons' ), '.academy-lesson-curriculum-toggle', 'inline-flex' ); $this->end_controls_section(); $this->start_controls_section( 'curriculum_top_progress_content', [ 'label' => __( 'Progress', 'academy-elementor-addons' ), ] ); $this->visibility( 'curriculum_top_progress_main', __( 'Show Progress Circle', 'academy-elementor-addons' ), '.academy-progressbar' ); $this->visibility( 'curriculum_top_progress_text', __( 'Show Progress Label', 'academy-elementor-addons' ), '.academy-progress-trigger__label', 'flex' ); $this->add_control( 'curriculum_top_progress_title', [ 'label' => __( 'Progress Label', 'academy-elementor-addons' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Your Progress', 'academy-elementor-addons' ), 'label_block' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'curriculum_top_share', [ 'label' => __( 'Actions', 'academy-elementor-addons' ), ] ); $this->visibility( 'curriculum_top_show_share', __( 'Show Share Item', 'academy-elementor-addons' ), '.academy-lesson-menu__item--share' ); $this->visibility( 'curriculum_top_show_menu', __( 'Show More Menu', 'academy-elementor-addons' ), '.academy-lesson-menu' ); $this->end_controls_section(); $this->start_controls_section( 'curriculum_top_section', [ 'label' => __( 'Topbar Layout', 'academy-elementor-addons' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'curriculum_top_section_bg', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .academy-lesson-topbar', ] ); $this->dimension( 'curriculum_top_section_bg_margin', __( 'Margin', 'academy-elementor-addons' ), '.academy-lesson-topbar', 'margin' ); $this->dimension( 'curriculum_top_section_bg_padding', __( 'Padding', 'academy-elementor-addons' ), '.academy-lesson-topbar', 'padding' ); $this->slider( 'curriculum_top_section_gap', __( 'Items Gap', 'academy-elementor-addons' ), '.academy-lesson-topbar__left, {{WRAPPER}} .academy-lesson-topbar__right', 'gap', 64 ); $this->color( 'curriculum_top_section_cancel_button', __( 'Close Icon Color', 'academy-elementor-addons' ), '.academy-lesson-menu__item--close .academy-icon, {{WRAPPER}} .academy-lesson-menu__item--close', 'color' ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'curriculum_top_section_border', 'selector' => '{{WRAPPER}} .academy-lesson-topbar', ] ); $this->end_controls_section(); $this->start_controls_section( 'curriculum_top_logo_style', [ 'label' => __( 'Back Arrow', 'academy-elementor-addons' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'curriculum_top_show_logo' => 'block' ], ] ); $this->slider( 'curriculum_top_logo_width', __( 'Icon Size', 'academy-elementor-addons' ), '.academy-lesson-breadcrumb__back .academy-icon', 'font-size', 80 ); $this->color( 'curriculum_top_logo_color', __( 'Arrow Color', 'academy-elementor-addons' ), '.academy-lesson-breadcrumb__back' ); $this->add_responsive_control( 'curriculum_top_logo_border_width', [ 'label' => __( 'Border Width', 'academy-elementor-addons' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 10 ] ], 'selectors' => [ '{{WRAPPER}} .academy-lesson-breadcrumb__back' => 'border-style: solid; border-width: {{SIZE}}{{UNIT}};' ], ] ); $this->color( 'curriculum_top_logo_border_color', __( 'Border Color', 'academy-elementor-addons' ), '.academy-lesson-breadcrumb__back', 'border-color' ); $this->add_control( 'curriculum_top_logo_border_style', [ 'label' => __( 'Border Style', 'academy-elementor-addons' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'Default', 'academy-elementor-addons' ), 'solid' => __( 'Solid', 'academy-elementor-addons' ), 'dashed' => __( 'Dashed', 'academy-elementor-addons' ) ], 'selectors' => [ '{{WRAPPER}} .academy-lesson-breadcrumb__back' => 'border-style: {{VALUE}};' ], ] ); $this->end_controls_section(); $this->start_controls_section( 'curriculum_top_title_style', [ 'label' => __( 'Course Title & Breadcrumb', 'academy-elementor-addons' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->color( 'curriculum_top_title_color', __( 'Course Title Color', 'academy-elementor-addons' ), '.academy-lesson-breadcrumb__text b' ); $this->typography( 'curriculum_top_title_typography', __( 'Course Title Typography', 'academy-elementor-addons' ), '.academy-lesson-breadcrumb__text b' ); $this->color( 'curriculum_top_back_text_color', __( 'Back Text Color', 'academy-elementor-addons' ), '.academy-lesson-breadcrumb__text small' ); $this->typography( 'curriculum_top_back_text_typography', __( 'Back Text Typography', 'academy-elementor-addons' ), '.academy-lesson-breadcrumb__text small' ); $this->color( 'curriculum_top_course_toggle_color', __( 'Content Button Color', 'academy-elementor-addons' ), '.academy-lesson-curriculum-toggle' ); $this->color( 'curriculum_top_course_toggle_bg', __( 'Content Button Background', 'academy-elementor-addons' ), '.academy-lesson-curriculum-toggle', 'background-color' ); $this->end_controls_section(); $this->start_controls_section( 'curriculum_top_progress_style_main', [ 'label' => __( 'Progress Circle & Label', 'academy-elementor-addons' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->slider( 'curriculum_top_progress_width_height', __( 'Circle Size', 'academy-elementor-addons' ), '.academy-progressbar svg', 'width', 150 ); $this->slider( 'curriculum_top_progress_circle_height', __( 'Circle Height', 'academy-elementor-addons' ), '.academy-progressbar svg', 'height', 150 ); $this->color( 'curriculum_top_progress_main_color', __( 'Completed Progress Color', 'academy-elementor-addons' ), '.academy-progressbar__circle-progress', 'stroke' ); $this->color( 'curriculum_top_progress_track_color', __( 'Progress Track Color', 'academy-elementor-addons' ), '.academy-progressbar__circle-background', 'stroke' ); $this->typography( 'curriculum_top_progress_main_round_typography', __( 'Percentage Typography', 'academy-elementor-addons' ), '.academy-progressbar__text' ); $this->color( 'curriculum_top_progress_main_round_color', __( 'Percentage Color', 'academy-elementor-addons' ), '.academy-progressbar__text' ); $this->color( 'curriculum_top_progress_label_color', __( 'Progress Label Color', 'academy-elementor-addons' ), '.academy-progress-trigger__label' ); $this->typography( 'curriculum_top_progress_label_typography', __( 'Progress Label Typography', 'academy-elementor-addons' ), '.academy-progress-trigger__label' ); $this->end_controls_section(); $this->start_controls_section( 'curriculum_top_share_button', [ 'label' => __( 'Action Menu', 'academy-elementor-addons' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->typography( 'curriculum_top_share_button_typography', __( 'Menu Typography', 'academy-elementor-addons' ), '.academy-lesson-menu__dropdown' ); $this->start_controls_tabs( 'curriculum_top_action_tabs' ); $this->start_controls_tab( 'curriculum_top_share_button_normal', [ 'label' => __( 'Normal', 'academy-elementor-addons' ) ] ); $this->color( 'curriculum_top_action_color', __( 'Text & Icons', 'academy-elementor-addons' ), '.academy-lesson-menu__item, {{WRAPPER}} .academy-lesson-menu__toggle' ); $this->color( 'curriculum_top_action_background', __( 'Menu Background', 'academy-elementor-addons' ), '.academy-lesson-menu__dropdown', 'background-color' ); $this->end_controls_tab(); $this->start_controls_tab( 'curriculum_top_share_button_hover', [ 'label' => __( 'Hover', 'academy-elementor-addons' ) ] ); $this->color( 'curriculum_top_action_hover_color', __( 'Text & Icons', 'academy-elementor-addons' ), '.academy-lesson-menu__item:hover, {{WRAPPER}} .academy-lesson-menu__toggle:hover' ); $this->color( 'curriculum_top_action_hover_background', __( 'Item Background', 'academy-elementor-addons' ), '.academy-lesson-menu__item:hover', 'background-color' ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'curriculum_top_action_border', 'selector' => '{{WRAPPER}} .academy-lesson-menu__dropdown' ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'curriculum_top_action_shadow', 'selector' => '{{WRAPPER}} .academy-lesson-menu__dropdown' ] ); $this->dimension( 'curriculum_top_action_padding', __( 'Menu Padding', 'academy-elementor-addons' ), '.academy-lesson-menu__dropdown', 'padding' ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); $label = isset( $settings['curriculum_top_progress_title'] ) ? $settings['curriculum_top_progress_title'] : __( 'Your Progress', 'academy-elementor-addons' ); $markup = do_shortcode( '[academy_course_curriculum_topbar progress_ber_text="' . esc_attr( $label ) . '"]' ); if ( trim( $markup ) !== '' && $markup !== '[academy_course_curriculum_topbar progress_ber_text="' . esc_attr( $label ) . '"]' ) { // Preserve Academy's own menu, drawer, favorite and progress behavior. echo $markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped return; } // Outside a lesson Academy has no current course ID. Show an explicitly // inert design preview so controls can be verified on a normal Elementor page. ?>
☰
30% ⋯