| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget; |
| 4 |
|
| 5 |
use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget; |
| 6 |
use Elementor\Controls_Manager; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
class PrintButton extends BaseWidget { |
| 11 |
|
| 12 |
public function get_name() { |
| 13 |
return 'betterdocs-print-button'; |
| 14 |
} |
| 15 |
|
| 16 |
public function get_title() { |
| 17 |
return __( 'Print Button', 'betterdocs' ); |
| 18 |
} |
| 19 |
|
| 20 |
public function get_categories() { |
| 21 |
return [ 'betterdocs-elements-single' ]; |
| 22 |
} |
| 23 |
|
| 24 |
public function get_keywords() { |
| 25 |
return [ 'betterdocs-elements', 'print', 'docs', 'betterdocs' ]; |
| 26 |
} |
| 27 |
|
| 28 |
public function get_icon() { |
| 29 |
return 'betterdocs-icon-printer'; |
| 30 |
} |
| 31 |
|
| 32 |
protected function register_controls() { |
| 33 |
$this->start_controls_section( |
| 34 |
'print_button_section', |
| 35 |
[ |
| 36 |
'label' => __( 'Icon', 'betterdocs' ), |
| 37 |
'tab' => Controls_Manager::TAB_STYLE, |
| 38 |
] |
| 39 |
); |
| 40 |
|
| 41 |
$this->add_responsive_control( |
| 42 |
'print_button_size', |
| 43 |
[ |
| 44 |
'label' => __( 'Size', 'betterdocs' ), |
| 45 |
'type' => Controls_Manager::SLIDER, |
| 46 |
'size_units' => [ 'px', '%', 'em' ], |
| 47 |
'range' => [ |
| 48 |
'%' => [ |
| 49 |
'max' => 100, |
| 50 |
'step' => 1 |
| 51 |
] |
| 52 |
], |
| 53 |
'selectors' => [ |
| 54 |
'{{WRAPPER}} .betterdocs-print-pdf-2 .betterdocs-print-btn-2 svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};' |
| 55 |
] |
| 56 |
] |
| 57 |
); |
| 58 |
|
| 59 |
$this->add_control( |
| 60 |
'print_button_background_color', |
| 61 |
[ |
| 62 |
'label' => esc_html__( 'Background Color', 'betterdocs' ), |
| 63 |
'type' => Controls_Manager::COLOR, |
| 64 |
'selectors' => [ |
| 65 |
'{{WRAPPER}} .betterdocs-print-pdf-2 .betterdocs-print-btn-2 svg' => 'background-color: {{VALUE}};' |
| 66 |
] |
| 67 |
] |
| 68 |
); |
| 69 |
|
| 70 |
$this->end_controls_section(); |
| 71 |
} |
| 72 |
|
| 73 |
public function view_params() { |
| 74 |
return [ |
| 75 |
'enable' => true |
| 76 |
]; |
| 77 |
} |
| 78 |
|
| 79 |
public function render_callback() { |
| 80 |
$this->views( 'templates/parts/print-icon-2' ); |
| 81 |
} |
| 82 |
} |
| 83 |
|