| 1 |
<?php |
| 2 |
namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; // Exit if accessed directly |
| 6 |
} |
| 7 |
|
| 8 |
use Elementor\Controls_Manager; |
| 9 |
use Elementor\Group_Control_Typography; |
| 10 |
use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget; |
| 11 |
|
| 12 |
class DocDate extends BaseWidget { |
| 13 |
public $view_wrapper = 'betterdocs-updated-date-wrapper update-date'; |
| 14 |
|
| 15 |
public function get_name() { |
| 16 |
return 'betterdocs-doc-date'; |
| 17 |
} |
| 18 |
|
| 19 |
public function get_title() { |
| 20 |
return __( 'Doc Date', 'betterdocs' ); |
| 21 |
} |
| 22 |
|
| 23 |
public function get_icon() { |
| 24 |
return 'betterdocs-icon-date'; |
| 25 |
} |
| 26 |
|
| 27 |
public function get_categories() { |
| 28 |
return [ 'betterdocs-elements-single' ]; |
| 29 |
} |
| 30 |
|
| 31 |
public function get_keywords() { |
| 32 |
return [ 'betterdocs-elements', 'date', 'docs', 'betterdocs' ]; |
| 33 |
} |
| 34 |
|
| 35 |
public function get_custom_help_url() { |
| 36 |
return 'https://betterdocs.co/docs/single-doc-in-elementor'; |
| 37 |
} |
| 38 |
|
| 39 |
protected function register_controls() { |
| 40 |
|
| 41 |
$this->start_controls_section( |
| 42 |
'doc_date_general_section', |
| 43 |
[ |
| 44 |
'label' => __( 'General', 'betterdocs' ), |
| 45 |
'tab' => Controls_Manager::TAB_CONTENT |
| 46 |
] |
| 47 |
); |
| 48 |
|
| 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 |
); |
| 57 |
|
| 58 |
$this->end_controls_section(); |
| 59 |
|
| 60 |
$this->start_controls_section( |
| 61 |
'section_column_settings', |
| 62 |
[ |
| 63 |
'label' => __( 'Style', 'betterdocs' ), |
| 64 |
'tab' => Controls_Manager::TAB_STYLE |
| 65 |
] |
| 66 |
); |
| 67 |
|
| 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 |
); |
| 78 |
|
| 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 |
} |
| 129 |
} |
| 130 |
|