-
Notifications
You must be signed in to change notification settings - Fork 101
/
hello-world.php
executable file
·106 lines (89 loc) · 1.96 KB
/
hello-world.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
namespace HelloWorld\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Elementor Hello World
*
* Elementor widget for hello world.
*
* @since 1.0.0
*/
class Hello_World extends Widget_Base {
public function get_name() {
return 'hello-world';
}
public function get_title() {
return __( 'Hello World', 'hello-world' );
}
public function get_icon() {
return 'posts-ticker';
}
public function get_categories() {
return [ 'general-elements' ];
}
/**
* A list of scripts that the widgets is depended in
* @since 1.3.0
**/
/*
public function get_script_depends() {
return [ 'imagesloaded' ];
}
*/
protected function _register_controls() {
$this->start_controls_section(
'section_content',
[
'label' => __( 'Content', 'hello-world' ),
]
);
$this->add_control(
'title',
[
'label' => __( 'Title', 'hello-world' ),
'type' => Controls_Manager::TEXT,
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_style',
[
'label' => __( 'Style', 'hello-world' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'text_transform',
[
'label' => __( 'Text Transform', 'hello-world' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => __( 'None', 'hello-world' ),
'uppercase' => __( 'UPPERCASE', 'hello-world' ),
'lowercase' => __( 'lowercase', 'hello-world' ),
'capitalize' => __( 'Capitalize', 'hello-world' ),
],
'selectors' => [
'{{WRAPPER}} .title' => 'text-transform: {{VALUE}};',
],
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings();
echo '<div class="title">';
echo $settings['title'];
echo '</div>';
}
protected function _content_template() {
?>
<div class="title">
{{{ settings.title }}}
</div>
<?php
}
}