PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.3.17
UiCore Elements – Free widgets and templates for Elementor v1.3.17
1.3.18 1.3.17 1.3.16 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.2.0 1.2.1 1.2.2 1.2.3 All 42 releases
← All changes | includes/widgets/theme-builder/the-title.php +258 -253 1.2.1 → 1.3.17 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 namespace UiCoreElements\ThemeBuilder\Widgets;
3 4
4 5 use Elementor\Widget_Base;
5 6 use Elementor\Controls_Manager;
@@ -7,12 +8,10 @@
7 8 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
8 9 use Elementor\Group_Control_Typography;
9 10 use Elementor\Group_Control_Text_Shadow;
10 11 use Elementor\Group_Control_Text_Stroke;
11 -use Elementor\Utils;
12 -//use UiCoreElements\Extender;
12 +use UiCoreElements\Helper;
13 13
14 -
15 14 defined('ABSPATH') || exit();
16 15
17 16 /**
18 17 * The Title widget.
@@ -18,285 +17,291 @@
18 17 * The Title widget.
19 18 *
20 19 * @since 4.0.0
21 20 */
22 -class TheTitle extends Widget_Base {
21 +class TheTitle extends Widget_Base
22 +{
23 23
24 - /**
25 - * Get widget name.
26 - *
27 - * Retrieve heading widget name.
28 - *
29 - * @since 1.0.0
30 - * @access public
31 - *
32 - * @return string Widget name.
33 - */
34 - public function get_name() {
35 - return 'uicore-the-title';
36 - }
24 + /**
25 + * Get widget name.
26 + *
27 + * Retrieve heading widget name.
28 + *
29 + * @since 1.0.0
30 + * @access public
31 + *
32 + * @return string Widget name.
33 + */
34 + public function get_name()
35 + {
36 + return 'uicore-the-title';
37 + }
37 38
38 - /**
39 - * Get widget title.
40 - *
41 - * Retrieve heading widget title.
42 - *
43 - * @since 1.0.0
44 - * @access public
45 - *
46 - * @return string Widget title.
47 - */
48 - public function get_title() {
49 - return esc_html__( 'The Title', 'uicore-elements' );
50 - }
39 + /**
40 + * Get widget title.
41 + *
42 + * Retrieve heading widget title.
43 + *
44 + * @since 1.0.0
45 + * @access public
46 + *
47 + * @return string Widget title.
48 + */
49 + public function get_title()
50 + {
51 + return esc_html__('The Title', 'uicore-elements');
52 + }
51 53
52 - /**
53 - * Get widget icon.
54 - *
55 - * Retrieve heading widget icon.
56 - *
57 - * @since 1.0.0
58 - * @access public
59 - *
60 - * @return string Widget icon.
61 - */
62 - public function get_icon() {
63 - return 'eicon-t-letter ui-e-widget';
64 - }
54 + /**
55 + * Get widget icon.
56 + *
57 + * Retrieve heading widget icon.
58 + *
59 + * @since 1.0.0
60 + * @access public
61 + *
62 + * @return string Widget icon.
63 + */
64 + public function get_icon()
65 + {
66 + return 'eicon-t-letter ui-e-widget';
67 + }
65 68
66 - /**
67 - * Get widget categories.
68 - *
69 - * Retrieve the list of categories the heading widget belongs to.
70 - *
71 - * Used to determine where to display the widget in the editor.
72 - *
73 - * @since 2.0.0
74 - * @access public
75 - *
76 - * @return array Widget categories.
77 - */
78 - public function get_categories() {
79 - return ['uicore', 'uicore-theme-builder' ];
80 - }
69 + /**
70 + * Get widget categories.
71 + *
72 + * Retrieve the list of categories the heading widget belongs to.
73 + *
74 + * Used to determine where to display the widget in the editor.
75 + *
76 + * @since 2.0.0
77 + * @access public
78 + *
79 + * @return array Widget categories.
80 + */
81 + public function get_categories()
82 + {
83 + return ['uicore', 'uicore-theme-builder'];
84 + }
81 85
82 - /**
83 - * Get widget keywords.
84 - *
85 - * Retrieve the list of keywords the widget belongs to.
86 - *
87 - * @since 2.1.0
88 - * @access public
89 - *
90 - * @return array Widget keywords.
91 - */
92 - public function get_keywords() {
93 - return [ 'heading', 'title', 'text' ];
94 - }
86 + /**
87 + * Get widget keywords.
88 + *
89 + * Retrieve the list of keywords the widget belongs to.
90 + *
91 + * @since 2.1.0
92 + * @access public
93 + *
94 + * @return array Widget keywords.
95 + */
96 + public function get_keywords()
97 + {
98 + return ['heading', 'title', 'text'];
99 + }
95 100
96 - // TODO: remove or set as false, after 3.30, when the full deprecation of widget innet wrapper is ready
97 - public function has_widget_inner_wrapper(): bool {
98 - return true;
101 + public function has_widget_inner_wrapper(): bool
102 + {
103 + // TODO: remove after Optmized Markup experiment is merged to the core
104 + return ! \Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup');
99 105 }
100 106
101 - /**
102 - * Register heading widget controls.
103 - *
104 - * Adds different input fields to allow the user to change and customize the widget settings.
105 - *
106 - * @since 3.1.0
107 - * @access protected
108 - */
109 - protected function register_controls() {
110 - $this->start_controls_section(
111 - 'section_title',
112 - [
113 - 'label' => esc_html__( 'Title', 'uicore-elements' ),
114 - ]
115 - );
107 + /**
108 + * Register heading widget controls.
109 + *
110 + * Adds different input fields to allow the user to change and customize the widget settings.
111 + *
112 + * @since 3.1.0
113 + * @access protected
114 + */
115 + protected function register_controls()
116 + {
117 + $this->start_controls_section(
118 + 'section_title',
119 + [
120 + 'label' => esc_html__('Title', 'uicore-elements'),
121 + ]
122 + );
116 123
117 - $this->add_control(
118 - 'header_size',
119 - [
120 - 'label' => esc_html__( 'HTML Tag', 'uicore-elements' ),
121 - 'type' => Controls_Manager::SELECT,
122 - 'options' => [
123 - 'h1' => 'H1',
124 - 'h2' => 'H2',
125 - 'h3' => 'H3',
126 - 'h4' => 'H4',
127 - 'h5' => 'H5',
128 - 'h6' => 'H6',
129 - 'div' => 'div',
130 - 'span' => 'span',
131 - 'p' => 'p',
132 - ],
133 - 'default' => 'h2',
134 - ]
135 - );
124 + $this->add_control(
125 + 'header_size',
126 + [
127 + 'label' => esc_html__('HTML Tag', 'uicore-elements'),
128 + 'type' => Controls_Manager::SELECT,
129 + 'options' => [
130 + 'h1' => 'H1',
131 + 'h2' => 'H2',
132 + 'h3' => 'H3',
133 + 'h4' => 'H4',
134 + 'h5' => 'H5',
135 + 'h6' => 'H6',
136 + 'div' => 'div',
137 + 'span' => 'span',
138 + 'p' => 'p',
139 + ],
140 + 'default' => 'h2',
141 + ]
142 + );
136 143
137 - $this->add_responsive_control(
138 - 'align',
139 - [
140 - 'label' => esc_html__( 'Alignment', 'uicore-elements' ),
141 - 'type' => Controls_Manager::CHOOSE,
142 - 'options' => [
143 - 'left' => [
144 - 'title' => esc_html__( 'Left', 'uicore-elements' ),
145 - 'icon' => 'eicon-text-align-left',
146 - ],
147 - 'center' => [
148 - 'title' => esc_html__( 'Center', 'uicore-elements' ),
149 - 'icon' => 'eicon-text-align-center',
150 - ],
151 - 'right' => [
152 - 'title' => esc_html__( 'Right', 'uicore-elements' ),
153 - 'icon' => 'eicon-text-align-right',
154 - ],
155 - 'justify' => [
156 - 'title' => esc_html__( 'Justified', 'uicore-elements' ),
157 - 'icon' => 'eicon-text-align-justify',
158 - ],
159 - ],
160 - 'default' => '',
161 - 'selectors' => [
162 - '{{WRAPPER}}' => 'text-align: {{VALUE}};',
163 - ],
164 - ]
165 - );
144 + $this->add_responsive_control(
145 + 'align',
146 + [
147 + 'label' => esc_html__('Alignment', 'uicore-elements'),
148 + 'type' => Controls_Manager::CHOOSE,
149 + 'options' => [
150 + 'left' => [
151 + 'title' => esc_html__('Left', 'uicore-elements'),
152 + 'icon' => 'eicon-text-align-left',
153 + ],
154 + 'center' => [
155 + 'title' => esc_html__('Center', 'uicore-elements'),
156 + 'icon' => 'eicon-text-align-center',
157 + ],
158 + 'right' => [
159 + 'title' => esc_html__('Right', 'uicore-elements'),
160 + 'icon' => 'eicon-text-align-right',
161 + ],
162 + 'justify' => [
163 + 'title' => esc_html__('Justified', 'uicore-elements'),
164 + 'icon' => 'eicon-text-align-justify',
165 + ],
166 + ],
167 + 'default' => '',
168 + 'selectors' => [
169 + '{{WRAPPER}}' => 'text-align: {{VALUE}};',
170 + ],
171 + ]
172 + );
166 173
167 - $this->add_control(
168 - 'view',
169 - [
170 - 'label' => esc_html__( 'View', 'uicore-elements' ),
171 - 'type' => Controls_Manager::HIDDEN,
172 - 'default' => 'traditional',
173 - ]
174 - );
174 + $this->add_control(
175 + 'view',
176 + [
177 + 'label' => esc_html__('View', 'uicore-elements'),
178 + 'type' => Controls_Manager::HIDDEN,
179 + 'default' => 'traditional',
180 + ]
181 + );
175 182
176 - $this->end_controls_section();
183 + $this->end_controls_section();
177 184
178 - $this->start_controls_section(
179 - 'section_title_style',
180 - [
181 - 'label' => esc_html__( 'Title', 'uicore-elements' ),
182 - 'tab' => Controls_Manager::TAB_STYLE,
183 - ]
184 - );
185 + $this->start_controls_section(
186 + 'section_title_style',
187 + [
188 + 'label' => esc_html__('Title', 'uicore-elements'),
189 + 'tab' => Controls_Manager::TAB_STYLE,
190 + ]
191 + );
185 192
186 - $this->add_control(
187 - 'title_color',
188 - [
189 - 'label' => esc_html__( 'Text Color', 'uicore-elements' ),
190 - 'type' => Controls_Manager::COLOR,
191 - 'global' => [
192 - 'default' => Global_Colors::COLOR_PRIMARY,
193 - ],
194 - 'selectors' => [
195 - '{{WRAPPER}} .elementor-heading-title' => 'color: {{VALUE}};',
196 - ],
197 - ]
198 - );
193 + $this->add_control(
194 + 'title_color',
195 + [
196 + 'label' => esc_html__('Text Color', 'uicore-elements'),
197 + 'type' => Controls_Manager::COLOR,
198 + 'default' => 'var(--e-global-color-uicore_primary)',
199 199
200 - $this->add_group_control(
201 - Group_Control_Typography::get_type(),
202 - [
203 - 'name' => 'typography',
204 - 'global' => [
205 - 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
206 - ],
207 - 'selector' => '{{WRAPPER}} .elementor-heading-title',
208 - ]
209 - );
200 + 'selectors' => [
201 + '{{WRAPPER}} .elementor-heading-title' => 'color: {{VALUE}};',
202 + ],
203 + ]
204 + );
210 205
211 - $this->add_group_control(
212 - Group_Control_Text_Stroke::get_type(),
213 - [
214 - 'name' => 'text_stroke',
215 - 'selector' => '{{WRAPPER}} .elementor-heading-title',
216 - ]
217 - );
206 + $this->add_group_control(
207 + Group_Control_Typography::get_type(),
208 + [
209 + 'name' => 'typography',
210 + 'global' => [
211 + 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
212 + ],
213 + 'selector' => '{{WRAPPER}} .elementor-heading-title',
214 + ]
215 + );
218 216
219 - $this->add_group_control(
220 - Group_Control_Text_Shadow::get_type(),
221 - [
222 - 'name' => 'text_shadow',
223 - 'selector' => '{{WRAPPER}} .elementor-heading-title',
224 - ]
225 - );
217 + $this->add_group_control(
218 + Group_Control_Text_Stroke::get_type(),
219 + [
220 + 'name' => 'text_stroke',
221 + 'selector' => '{{WRAPPER}} .elementor-heading-title',
222 + ]
223 + );
226 224
227 - $this->add_control(
228 - 'blend_mode',
229 - [
230 - 'label' => esc_html__( 'Blend Mode', 'uicore-elements' ),
231 - 'type' => Controls_Manager::SELECT,
232 - 'options' => [
233 - '' => esc_html__( 'Normal', 'uicore-elements' ),
234 - 'multiply' => 'Multiply',
235 - 'screen' => 'Screen',
236 - 'overlay' => 'Overlay',
237 - 'darken' => 'Darken',
238 - 'lighten' => 'Lighten',
239 - 'color-dodge' => 'Color Dodge',
240 - 'saturation' => 'Saturation',
241 - 'color' => 'Color',
242 - 'difference' => 'Difference',
243 - 'exclusion' => 'Exclusion',
244 - 'hue' => 'Hue',
245 - 'luminosity' => 'Luminosity',
246 - ],
247 - 'selectors' => [
248 - '{{WRAPPER}} .elementor-heading-title' => 'mix-blend-mode: {{VALUE}}',
249 - ],
250 - 'separator' => 'none',
251 - ]
252 - );
225 + $this->add_group_control(
226 + Group_Control_Text_Shadow::get_type(),
227 + [
228 + 'name' => 'text_shadow',
229 + 'selector' => '{{WRAPPER}} .elementor-heading-title',
230 + ]
231 + );
253 232
254 - $this->end_controls_section();
233 + $this->add_control(
234 + 'blend_mode',
235 + [
236 + 'label' => esc_html__('Blend Mode', 'uicore-elements'),
237 + 'type' => Controls_Manager::SELECT,
238 + 'options' => [
239 + '' => esc_html__('Normal', 'uicore-elements'),
240 + 'multiply' => 'Multiply',
241 + 'screen' => 'Screen',
242 + 'overlay' => 'Overlay',
243 + 'darken' => 'Darken',
244 + 'lighten' => 'Lighten',
245 + 'color-dodge' => 'Color Dodge',
246 + 'saturation' => 'Saturation',
247 + 'color' => 'Color',
248 + 'difference' => 'Difference',
249 + 'exclusion' => 'Exclusion',
250 + 'hue' => 'Hue',
251 + 'luminosity' => 'Luminosity',
252 + ],
253 + 'selectors' => [
254 + '{{WRAPPER}} .elementor-heading-title' => 'mix-blend-mode: {{VALUE}}',
255 + ],
256 + 'separator' => 'none',
257 + ]
258 + );
255 259
256 - }
260 + $this->end_controls_section();
261 + }
257 262
258 - /**
259 - * Render heading widget output on the frontend.
260 - *
261 - * Written in PHP and used to generate the final HTML.
262 - *
263 - * @since 1.0.0
264 - * @access protected
265 - */
266 - protected function render() {
267 - $settings = $this->get_settings_for_display();
263 + /**
264 + * Render heading widget output on the frontend.
265 + *
266 + * Written in PHP and used to generate the final HTML.
267 + *
268 + * @since 1.0.0
269 + * @access protected
270 + */
271 + protected function render()
272 + {
273 + $settings = $this->get_settings_for_display();
268 274
269 - $this->add_render_attribute( 'title', 'class', 'elementor-heading-title' );
275 + $this->add_render_attribute('title', 'class', 'elementor-heading-title');
270 276
271 - if( !\Elementor\Plugin::$instance->editor->is_edit_mode() ) {
277 + if (!\Elementor\Plugin::$instance->editor->is_edit_mode()) {
272 278
273 - // If there is a post.
274 - if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) {
275 - $title = single_post_title( '', false );
276 - }else{
277 - $title = wp_title(null,false);
278 - }
279 + // If there is a post.
280 + if (is_single() || (is_home() && ! is_front_page()) || (is_page() && ! is_front_page())) {
281 + $title = single_post_title('', false);
282 + } else {
283 + $title = wp_title(null, false);
284 + }
279 285
280 286 $title = $title ? $title : get_bloginfo('name');
281 - }else{
282 - $title = __( 'This is a dummy title.', 'uicore-elements' );
287 + } else {
288 + $title = __('This is a dummy title.', 'uicore-elements');
283 289 }
284 290
285 - $title_html = sprintf( '<%1$s %2$s>%3$s</%1$s>', Utils::validate_html_tag($settings['header_size']), $this->get_render_attribute_string( 'title' ), \esc_html($title) );
291 + $title_html = sprintf('<%1$s %2$s>%3$s</%1$s>', Helper::esc_tag($settings['header_size']), $this->get_render_attribute_string('title'), \esc_html($title));
286 292
287 - // PHPCS - the variable $title_html holds safe data.
288 - echo $title_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
289 - }
293 + // PHPCS - the variable $title_html holds safe data.
294 + echo $title_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
295 + }
290 296
291 - /**
292 - * Render heading widget output in the editor.
293 - *
294 - * Written as a Backbone JavaScript template and used to generate the live preview.
295 - *
296 - * @since 2.9.0
297 - * @access protected
298 - */
299 - protected function content_template() {
300 - }
297 + /**
298 + * Render heading widget output in the editor.
299 + *
300 + * Written as a Backbone JavaScript template and used to generate the live preview.
301 + *
302 + * @since 2.9.0
303 + * @access protected
304 + */
305 + protected function content_template() {}
301 306 }
302 -\Elementor\Plugin::instance()->widgets_manager->register(new TheTitle());
307 +\Elementor\Plugin::instance()->widgets_manager->register(new TheTitle());