| @@ -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\Controls_Manager; |
| 9 | 9 | use Elementor\Group_Control_Typography; |
| @@ -9,96 +9,121 @@ | ||
| 9 | 9 | use Elementor\Group_Control_Typography; |
| 10 | 10 | use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget; |
| 11 | 11 | |
| 12 | 12 | class DocDate extends BaseWidget { |
| 13 | - public $view_wrapper = 'betterdocs-updated-date-wrapper update-date'; | |
| 13 | + public $view_wrapper = 'betterdocs-updated-date-wrapper update-date'; | |
| 14 | 14 | |
| 15 | - public function get_name() { | |
| 16 | - return 'betterdocs-doc-date'; | |
| 17 | - } | |
| 15 | + public function get_name() { | |
| 16 | + return 'betterdocs-doc-date'; | |
| 17 | + } | |
| 18 | 18 | |
| 19 | - public function get_title() { | |
| 20 | - return __( 'Doc Date', 'betterdocs' ); | |
| 21 | - } | |
| 19 | + public function get_title() { | |
| 20 | + return __( 'Doc Date', 'betterdocs' ); | |
| 21 | + } | |
| 22 | 22 | |
| 23 | - public function get_icon() { | |
| 24 | - return 'betterdocs-icon-date'; | |
| 25 | - } | |
| 23 | + public function get_icon() { | |
| 24 | + return 'betterdocs-icon-date'; | |
| 25 | + } | |
| 26 | 26 | |
| 27 | - public function get_categories() { | |
| 28 | - return ['betterdocs-elements-single']; | |
| 29 | - } | |
| 27 | + public function get_categories() { | |
| 28 | + return [ 'betterdocs-elements-single' ]; | |
| 29 | + } | |
| 30 | 30 | |
| 31 | - public function get_keywords() { | |
| 32 | - return ['betterdocs-elements', 'date', 'docs', 'betterdocs']; | |
| 33 | - } | |
| 31 | + public function get_keywords() { | |
| 32 | + return [ 'betterdocs-elements', 'date', 'docs', 'betterdocs' ]; | |
| 33 | + } | |
| 34 | 34 | |
| 35 | - public function get_custom_help_url() { | |
| 36 | - return 'https://betterdocs.co/docs/single-doc-in-elementor'; | |
| 37 | - } | |
| 35 | + public function get_custom_help_url() { | |
| 36 | + return 'https://betterdocs.co/docs/single-doc-in-elementor'; | |
| 37 | + } | |
| 38 | 38 | |
| 39 | - protected function register_controls() { | |
| 39 | + protected function register_controls() { | |
| 40 | 40 | |
| 41 | - $this->start_controls_section( | |
| 42 | - 'section_column_settings', | |
| 43 | - [ | |
| 44 | - 'label' => __( 'Style', 'betterdocs' ), | |
| 45 | - 'tab' => Controls_Manager::TAB_STYLE | |
| 46 | - ] | |
| 47 | - ); | |
| 41 | + $this->start_controls_section( | |
| 42 | + 'doc_date_general_section', | |
| 43 | + [ | |
| 44 | + 'label' => __( 'General', 'betterdocs' ), | |
| 45 | + 'tab' => Controls_Manager::TAB_CONTENT | |
| 46 | + ] | |
| 47 | + ); | |
| 48 | 48 | |
| 49 | - $this->add_control( | |
| 50 | - 'update_date_color', | |
| 51 | - [ | |
| 52 | - 'label' => esc_html__( 'Color', 'betterdocs' ), | |
| 53 | - 'type' => Controls_Manager::COLOR, | |
| 54 | - 'selectors' => [ | |
| 55 | - '{{WRAPPER}} .update-date' => 'color: {{VALUE}};' | |
| 56 | - ] | |
| 57 | - ] | |
| 58 | - ); | |
| 49 | + $this->add_control( | |
| 50 | + 'doc_date_general_updated_text', | |
| 51 | + [ | |
| 52 | + 'label' => __( 'Text', 'betterdocs' ), | |
| 53 | + 'type' => Controls_Manager::TEXT, | |
| 54 | + 'default' => esc_html__( 'Updated on', 'betterdocs' ) | |
| 55 | + ] | |
| 56 | + ); | |
| 59 | 57 | |
| 60 | - $this->add_group_control( | |
| 61 | - Group_Control_Typography::get_type(), | |
| 62 | - [ | |
| 63 | - 'name' => 'update_date_typography', | |
| 64 | - 'selector' => '{{WRAPPER}} .update-date' | |
| 65 | - ] | |
| 66 | - ); | |
| 58 | + $this->end_controls_section(); | |
| 67 | 59 | |
| 68 | - $this->add_responsive_control( | |
| 69 | - 'update_date_alignment', | |
| 70 | - [ | |
| 71 | - 'label' => __( 'Alignment', 'betterdocs' ), | |
| 72 | - 'type' => Controls_Manager::CHOOSE, | |
| 73 | - 'options' => [ | |
| 74 | - 'left' => [ | |
| 75 | - 'title' => __( 'Left', 'betterdocs' ), | |
| 76 | - 'icon' => 'eicon-text-align-left' | |
| 77 | - ], | |
| 78 | - 'center' => [ | |
| 79 | - 'title' => __( 'Center', 'betterdocs' ), | |
| 80 | - 'icon' => 'eicon-text-align-center' | |
| 81 | - ], | |
| 82 | - 'right' => [ | |
| 83 | - 'title' => __( 'Right', 'betterdocs' ), | |
| 84 | - 'icon' => 'eicon-text-align-right' | |
| 85 | - ], | |
| 86 | - 'justify' => [ | |
| 87 | - 'title' => __( 'Justified', 'betterdocs' ), | |
| 88 | - 'icon' => 'eicon-text-align-justify' | |
| 89 | - ] | |
| 90 | - ], | |
| 91 | - 'default' => '', | |
| 92 | - 'selectors' => [ | |
| 93 | - '{{WRAPPER}}' => 'text-align: {{VALUE}};' | |
| 94 | - ] | |
| 95 | - ] | |
| 96 | - ); | |
| 60 | + $this->start_controls_section( | |
| 61 | + 'section_column_settings', | |
| 62 | + [ | |
| 63 | + 'label' => __( 'Style', 'betterdocs' ), | |
| 64 | + 'tab' => Controls_Manager::TAB_STYLE | |
| 65 | + ] | |
| 66 | + ); | |
| 97 | 67 | |
| 98 | - $this->end_controls_section(); | |
| 99 | - } | |
| 68 | + $this->add_control( | |
| 69 | + 'update_date_color', | |
| 70 | + [ | |
| 71 | + 'label' => esc_html__( 'Color', 'betterdocs' ), | |
| 72 | + 'type' => Controls_Manager::COLOR, | |
| 73 | + 'selectors' => [ | |
| 74 | + '{{WRAPPER}} .update-date' => 'color: {{VALUE}};' | |
| 75 | + ] | |
| 76 | + ] | |
| 77 | + ); | |
| 100 | 78 | |
| 101 | - protected function render_callback() { | |
| 102 | - $this->views( 'widgets/date' ); | |
| 103 | - } | |
| 79 | + $this->add_group_control( | |
| 80 | + Group_Control_Typography::get_type(), | |
| 81 | + [ | |
| 82 | + 'name' => 'update_date_typography', | |
| 83 | + 'selector' => '{{WRAPPER}} .update-date' | |
| 84 | + ] | |
| 85 | + ); | |
| 86 | + | |
| 87 | + $this->add_responsive_control( | |
| 88 | + 'update_date_alignment', | |
| 89 | + [ | |
| 90 | + 'label' => __( 'Alignment', 'betterdocs' ), | |
| 91 | + 'type' => Controls_Manager::CHOOSE, | |
| 92 | + 'options' => [ | |
| 93 | + 'left' => [ | |
| 94 | + 'title' => __( 'Left', 'betterdocs' ), | |
| 95 | + 'icon' => 'eicon-text-align-left' | |
| 96 | + ], | |
| 97 | + 'center' => [ | |
| 98 | + 'title' => __( 'Center', 'betterdocs' ), | |
| 99 | + 'icon' => 'eicon-text-align-center' | |
| 100 | + ], | |
| 101 | + 'right' => [ | |
| 102 | + 'title' => __( 'Right', 'betterdocs' ), | |
| 103 | + 'icon' => 'eicon-text-align-right' | |
| 104 | + ], | |
| 105 | + 'justify' => [ | |
| 106 | + 'title' => __( 'Justified', 'betterdocs' ), | |
| 107 | + 'icon' => 'eicon-text-align-justify' | |
| 108 | + ] | |
| 109 | + ], | |
| 110 | + 'default' => '', | |
| 111 | + 'selectors' => [ | |
| 112 | + '{{WRAPPER}}' => 'text-align: {{VALUE}};' | |
| 113 | + ] | |
| 114 | + ] | |
| 115 | + ); | |
| 116 | + | |
| 117 | + $this->end_controls_section(); | |
| 118 | + } | |
| 119 | + | |
| 120 | + protected function render_callback() { | |
| 121 | + $this->views( 'widgets/date' ); | |
| 122 | + } | |
| 123 | + | |
| 124 | + public function view_params() { | |
| 125 | + return [ | |
| 126 | + 'doc_date_text' => $this->attributes['doc_date_general_updated_text'] | |
| 127 | + ]; | |
| 128 | + } | |
| 104 | 129 | } |