| 1 |
<?php |
| 2 |
|
| 3 |
use Elementor\Controls_Manager; |
| 4 |
use Elementor\Group_Control_Typography; |
| 5 |
use Elementor\Widget_Base; |
| 6 |
|
| 7 |
|
| 8 |
if (!defined('ABSPATH')) { |
| 9 |
exit; // Exit if accessed directly |
| 10 |
} |
| 11 |
|
| 12 |
class BetterDocs_Elementor_Doc_Date extends Widget_Base { |
| 13 |
|
| 14 |
public function get_name () { |
| 15 |
return 'betterdocs-doc-date'; |
| 16 |
} |
| 17 |
|
| 18 |
public function get_title () { |
| 19 |
return __('Doc Date', 'betterdocs'); |
| 20 |
} |
| 21 |
|
| 22 |
public function get_icon () { |
| 23 |
return 'betterdocs-icon-date'; |
| 24 |
} |
| 25 |
|
| 26 |
public function get_categories () { |
| 27 |
return ['betterdocs-elements-single']; |
| 28 |
} |
| 29 |
|
| 30 |
public function get_keywords () { |
| 31 |
return ['betterdocs-elements', 'date', 'docs', 'betterdocs']; |
| 32 |
} |
| 33 |
|
| 34 |
public function get_custom_help_url() { |
| 35 |
return 'https://betterdocs.co/docs/single-doc-in-elementor'; |
| 36 |
} |
| 37 |
|
| 38 |
protected function _register_controls () { |
| 39 |
|
| 40 |
$this->start_controls_section( |
| 41 |
'section_column_settings', |
| 42 |
[ |
| 43 |
'label' => __('Style', 'betterdocs'), |
| 44 |
'tab' => Controls_Manager::TAB_STYLE, |
| 45 |
] |
| 46 |
); |
| 47 |
|
| 48 |
$this->add_control( |
| 49 |
'update_date_color', |
| 50 |
[ |
| 51 |
'label' => esc_html__('Color', 'betterdocs'), |
| 52 |
'type' => Controls_Manager::COLOR, |
| 53 |
'selectors' => [ |
| 54 |
'{{WRAPPER}} .update-date' => 'color: {{VALUE}};', |
| 55 |
] |
| 56 |
] |
| 57 |
); |
| 58 |
|
| 59 |
$this->add_group_control( |
| 60 |
Group_Control_Typography::get_type(), |
| 61 |
[ |
| 62 |
'name' => 'update_date_typography', |
| 63 |
'selector' => '{{WRAPPER}} .update-date' |
| 64 |
] |
| 65 |
); |
| 66 |
|
| 67 |
$this->add_responsive_control( |
| 68 |
'update_date_alignment', |
| 69 |
[ |
| 70 |
'label' => __( 'Alignment', 'betterdocs' ), |
| 71 |
'type' => Controls_Manager::CHOOSE, |
| 72 |
'options' => [ |
| 73 |
'left' => [ |
| 74 |
'title' => __( 'Left', 'betterdocs' ), |
| 75 |
'icon' => 'eicon-text-align-left', |
| 76 |
], |
| 77 |
'center' => [ |
| 78 |
'title' => __( 'Center', 'betterdocs' ), |
| 79 |
'icon' => 'eicon-text-align-center', |
| 80 |
], |
| 81 |
'right' => [ |
| 82 |
'title' => __( 'Right', 'betterdocs' ), |
| 83 |
'icon' => 'eicon-text-align-right', |
| 84 |
], |
| 85 |
'justify' => [ |
| 86 |
'title' => __( 'Justified', 'betterdocs' ), |
| 87 |
'icon' => 'eicon-text-align-justify', |
| 88 |
], |
| 89 |
], |
| 90 |
'default' => '', |
| 91 |
'selectors' => [ |
| 92 |
'{{WRAPPER}}' => 'text-align: {{VALUE}};', |
| 93 |
], |
| 94 |
] |
| 95 |
); |
| 96 |
|
| 97 |
$this->end_controls_section(); |
| 98 |
} |
| 99 |
|
| 100 |
protected function render () { |
| 101 |
$show_last_update_time = BetterDocs_DB::get_settings('show_last_update_time'); |
| 102 |
if ($show_last_update_time == 1) { |
| 103 |
?> |
| 104 |
<div class="update-date"> |
| 105 |
<?php |
| 106 |
printf( |
| 107 |
esc_html__('Updated on %s', 'betterdocs'), |
| 108 |
get_the_modified_date() |
| 109 |
); |
| 110 |
?> |
| 111 |
</div> |
| 112 |
<?php |
| 113 |
} |
| 114 |
} |
| 115 |
} |
| 116 |
|