| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget; |
| 3 | 3 | |
| 4 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | - exit; // Exit if accessed directly | |
| 5 | + exit; // Exit if accessed directly | |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | use Elementor\Core\Schemes; |
| 9 | 9 | use Elementor\Controls_Manager; |
| @@ -10,141 +10,146 @@ | ||
| 10 | 10 | use Elementor\Group_Control_Typography; |
| 11 | 11 | use WPDeveloper\BetterDocs\Editors\Elementor\ContentBaseWidget; |
| 12 | 12 | |
| 13 | 13 | class Content extends ContentBaseWidget { |
| 14 | - public function get_name() { | |
| 15 | - return 'betterdocs-content'; | |
| 16 | - } | |
| 14 | + public function get_name() { | |
| 15 | + return 'betterdocs-content'; | |
| 16 | + } | |
| 17 | 17 | |
| 18 | - public function get_title() { | |
| 19 | - return __( 'Doc Content', 'betterdocs' ); | |
| 20 | - } | |
| 18 | + public function get_title() { | |
| 19 | + return __( 'Doc Content', 'betterdocs' ); | |
| 20 | + } | |
| 21 | 21 | |
| 22 | - public function get_icon() { | |
| 23 | - return 'betterdocs-icon-Content'; | |
| 24 | - } | |
| 22 | + public function has_widget_inner_wrapper():bool { | |
| 23 | + return false; | |
| 24 | + } | |
| 25 | 25 | |
| 26 | - public function get_categories() { | |
| 27 | - return ['betterdocs-elements-single']; | |
| 28 | - } | |
| 26 | + public function get_icon() { | |
| 27 | + return 'betterdocs-icon-Content'; | |
| 28 | + } | |
| 29 | 29 | |
| 30 | - public function get_keywords() { | |
| 31 | - return ['betterdocs-elements', 'content', 'description', 'docs', 'betterdocs']; | |
| 32 | - } | |
| 30 | + public function get_categories() { | |
| 31 | + return [ 'betterdocs-elements-single' ]; | |
| 32 | + } | |
| 33 | 33 | |
| 34 | - public function get_custom_help_url() { | |
| 35 | - return 'https://betterdocs.co/docs/single-doc-in-elementor'; | |
| 36 | - } | |
| 34 | + public function get_keywords() { | |
| 35 | + return [ 'betterdocs-elements', 'content', 'description', 'docs', 'betterdocs' ]; | |
| 36 | + } | |
| 37 | 37 | |
| 38 | - protected function register_controls() { | |
| 39 | - $this->start_controls_section( | |
| 40 | - 'section_style', | |
| 41 | - [ | |
| 42 | - 'label' => __( 'Style', 'betterdocs' ), | |
| 43 | - 'tab' => Controls_Manager::TAB_STYLE | |
| 44 | - ] | |
| 45 | - ); | |
| 38 | + public function get_custom_help_url() { | |
| 39 | + return 'https://betterdocs.co/docs/single-doc-in-elementor'; | |
| 40 | + } | |
| 46 | 41 | |
| 47 | - $this->add_control( | |
| 48 | - 'print_btn', | |
| 49 | - [ | |
| 50 | - 'label' => __( 'Print Button', 'betterdocs' ), | |
| 51 | - 'type' => Controls_Manager::SWITCHER, | |
| 52 | - 'label_on' => __( 'Show', 'betterdocs' ), | |
| 53 | - 'label_off' => __( 'Hide', 'betterdocs' ), | |
| 54 | - 'return_value' => '1', | |
| 55 | - 'default' => '1' | |
| 56 | - ] | |
| 57 | - ); | |
| 42 | + protected function register_controls() { | |
| 43 | + $this->start_controls_section( | |
| 44 | + 'section_style', | |
| 45 | + [ | |
| 46 | + 'label' => __( 'Style', 'betterdocs' ), | |
| 47 | + 'tab' => Controls_Manager::TAB_STYLE | |
| 48 | + ] | |
| 49 | + ); | |
| 58 | 50 | |
| 59 | - $this->add_responsive_control( | |
| 60 | - 'align', | |
| 61 | - [ | |
| 62 | - 'label' => __( 'Alignment', 'betterdocs' ), | |
| 63 | - 'type' => Controls_Manager::CHOOSE, | |
| 64 | - 'options' => [ | |
| 65 | - 'left' => [ | |
| 66 | - 'title' => __( 'Left', 'betterdocs' ), | |
| 67 | - 'icon' => 'eicon-text-align-left' | |
| 68 | - ], | |
| 69 | - 'center' => [ | |
| 70 | - 'title' => __( 'Center', 'betterdocs' ), | |
| 71 | - 'icon' => 'eicon-text-align-center' | |
| 72 | - ], | |
| 73 | - 'right' => [ | |
| 74 | - 'title' => __( 'Right', 'betterdocs' ), | |
| 75 | - 'icon' => 'eicon-text-align-right' | |
| 76 | - ], | |
| 77 | - 'justify' => [ | |
| 78 | - 'title' => __( 'Justified', 'betterdocs' ), | |
| 79 | - 'icon' => 'eicon-text-align-justify' | |
| 80 | - ] | |
| 81 | - ], | |
| 82 | - 'selectors' => [ | |
| 83 | - '{{WRAPPER}}' => 'text-align: {{VALUE}};' | |
| 84 | - ] | |
| 85 | - ] | |
| 86 | - ); | |
| 51 | + $this->add_control( | |
| 52 | + 'print_btn', | |
| 53 | + [ | |
| 54 | + 'label' => __( 'Print Button', 'betterdocs' ), | |
| 55 | + 'type' => Controls_Manager::SWITCHER, | |
| 56 | + 'label_on' => __( 'Show', 'betterdocs' ), | |
| 57 | + 'label_off' => __( 'Hide', 'betterdocs' ), | |
| 58 | + 'return_value' => '1', | |
| 59 | + 'default' => '1' | |
| 60 | + ] | |
| 61 | + ); | |
| 87 | 62 | |
| 88 | - $this->add_group_control( | |
| 89 | - Group_Control_Typography::get_type(), | |
| 90 | - [ | |
| 91 | - 'name' => 'betterdocs_content_typography', | |
| 92 | - 'selector' => '{{WRAPPER}} .betterdocs-content' | |
| 93 | - ] | |
| 94 | - ); | |
| 63 | + $this->add_responsive_control( | |
| 64 | + 'align', | |
| 65 | + [ | |
| 66 | + 'label' => __( 'Alignment', 'betterdocs' ), | |
| 67 | + 'type' => Controls_Manager::CHOOSE, | |
| 68 | + 'options' => [ | |
| 69 | + 'left' => [ | |
| 70 | + 'title' => __( 'Left', 'betterdocs' ), | |
| 71 | + 'icon' => 'eicon-text-align-left' | |
| 72 | + ], | |
| 73 | + 'center' => [ | |
| 74 | + 'title' => __( 'Center', 'betterdocs' ), | |
| 75 | + 'icon' => 'eicon-text-align-center' | |
| 76 | + ], | |
| 77 | + 'right' => [ | |
| 78 | + 'title' => __( 'Right', 'betterdocs' ), | |
| 79 | + 'icon' => 'eicon-text-align-right' | |
| 80 | + ], | |
| 81 | + 'justify' => [ | |
| 82 | + 'title' => __( 'Justified', 'betterdocs' ), | |
| 83 | + 'icon' => 'eicon-text-align-justify' | |
| 84 | + ] | |
| 85 | + ], | |
| 86 | + 'selectors' => [ | |
| 87 | + '{{WRAPPER}}' => 'text-align: {{VALUE}};' | |
| 88 | + ] | |
| 89 | + ] | |
| 90 | + ); | |
| 95 | 91 | |
| 96 | - $this->add_control( | |
| 97 | - 'doc_content_color', | |
| 98 | - [ | |
| 99 | - 'label' => __( 'Doc Content Color', 'betterdocs' ), | |
| 100 | - 'type' => Controls_Manager::COLOR, | |
| 101 | - 'selectors' => [ | |
| 102 | - '{{WRAPPER}} .betterdocs-content' => 'color: {{VALUE}}' | |
| 103 | - ] | |
| 104 | - ] | |
| 105 | - ); | |
| 92 | + $this->add_group_control( | |
| 93 | + Group_Control_Typography::get_type(), | |
| 94 | + [ | |
| 95 | + 'name' => 'betterdocs_content_typography', | |
| 96 | + 'selector' => '{{WRAPPER}} .betterdocs-content' | |
| 97 | + ] | |
| 98 | + ); | |
| 106 | 99 | |
| 107 | - $this->add_control( | |
| 108 | - 'doc_content_title_color', | |
| 109 | - [ | |
| 110 | - 'label' => __( 'Content Title Color', 'plugin-domain' ), | |
| 111 | - 'type' => Controls_Manager::COLOR, | |
| 112 | - 'selectors' => [ | |
| 113 | - '{{WRAPPER}} .betterdocs-content .betterdocs-content-heading' => 'color: {{VALUE}}' | |
| 114 | - ] | |
| 115 | - ] | |
| 116 | - ); | |
| 100 | + $this->add_control( | |
| 101 | + 'doc_content_color', | |
| 102 | + [ | |
| 103 | + 'label' => __( 'Doc Content Color', 'betterdocs' ), | |
| 104 | + 'type' => Controls_Manager::COLOR, | |
| 105 | + 'selectors' => [ | |
| 106 | + '{{WRAPPER}} .betterdocs-content' => 'color: {{VALUE}}', | |
| 107 | + '{{WRAPPER}} .betterdocs-content p' => 'color: {{VALUE}}', | |
| 108 | + ] | |
| 109 | + ] | |
| 110 | + ); | |
| 117 | 111 | |
| 118 | - $this->add_group_control( | |
| 119 | - Group_Control_Typography::get_type(), | |
| 120 | - [ | |
| 121 | - 'name' => 'betterdocs_content_title_typography', | |
| 122 | - 'selector' => '{{WRAPPER}} .betterdocs-content .betterdocs-content-heading' | |
| 123 | - ] | |
| 124 | - ); | |
| 125 | - $this->end_controls_section(); | |
| 126 | - } | |
| 112 | + $this->add_control( | |
| 113 | + 'doc_content_title_color', | |
| 114 | + [ | |
| 115 | + 'label' => __( 'Content Title Color', 'betterdocs' ), | |
| 116 | + 'type' => Controls_Manager::COLOR, | |
| 117 | + 'selectors' => [ | |
| 118 | + '{{WRAPPER}} .betterdocs-content .betterdocs-content-heading' => 'color: {{VALUE}}' | |
| 119 | + ] | |
| 120 | + ] | |
| 121 | + ); | |
| 127 | 122 | |
| 128 | - protected function render_callback() { | |
| 129 | - $this->views( 'widgets/content' ); | |
| 130 | - } | |
| 123 | + $this->add_group_control( | |
| 124 | + Group_Control_Typography::get_type(), | |
| 125 | + [ | |
| 126 | + 'name' => 'betterdocs_content_title_typography', | |
| 127 | + 'selector' => '{{WRAPPER}} .betterdocs-content .betterdocs-content-heading' | |
| 128 | + ] | |
| 129 | + ); | |
| 130 | + $this->end_controls_section(); | |
| 131 | + } | |
| 131 | 132 | |
| 132 | - public function view_params() { | |
| 133 | - $toc_setting = get_transient( 'betterdocs_toc_setting' ); | |
| 134 | - $htags = ( $toc_setting ) ? implode( ',', $toc_setting['htags'] ) : ''; | |
| 135 | - $enable_toc = ( $htags ) ? 1 : ''; | |
| 133 | + protected function render_callback() { | |
| 134 | + $this->views( 'widgets/content' ); | |
| 135 | + } | |
| 136 | 136 | |
| 137 | - return [ | |
| 138 | - 'enable' => (bool) $this->attributes['print_btn'], | |
| 139 | - 'htags' => $htags, | |
| 140 | - 'enable_toc' => $enable_toc, | |
| 141 | - 'wrapper_attr' => [ | |
| 142 | - 'class' => ['betterdocs-entry-content'] | |
| 143 | - ] | |
| 144 | - ]; | |
| 145 | - } | |
| 137 | + public function view_params() { | |
| 138 | + $toc_setting = get_transient( 'betterdocs_toc_setting' ); | |
| 139 | + $htags = ( $toc_setting ) ? implode( ',', $toc_setting['htags'] ) : ''; | |
| 140 | + $enable_toc = ( $htags ) ? 1 : ''; | |
| 146 | 141 | |
| 147 | - public function show_in_panel() { | |
| 148 | - return true; | |
| 149 | - } | |
| 142 | + return [ | |
| 143 | + 'enable' => (bool) $this->attributes['print_btn'], | |
| 144 | + 'htags' => $htags, | |
| 145 | + 'enable_toc' => $enable_toc, | |
| 146 | + 'wrapper_attr' => [ | |
| 147 | + 'class' => [ 'betterdocs-entry-content' ] | |
| 148 | + ] | |
| 149 | + ]; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public function show_in_panel() { | |
| 153 | + return true; | |
| 154 | + } | |
| 150 | 155 | } |