PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.3.18
UiCore Elements – Free widgets and templates for Elementor v1.3.18
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 +260 -250 1.0.5 → 1.3.18 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,280 +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 - /**
97 - * Register heading widget controls.
98 - *
99 - * Adds different input fields to allow the user to change and customize the widget settings.
100 - *
101 - * @since 3.1.0
102 - * @access protected
103 - */
104 - protected function register_controls() {
105 - $this->start_controls_section(
106 - 'section_title',
107 - [
108 - 'label' => esc_html__( 'Title', 'uicore-elements' ),
109 - ]
110 - );
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');
105 + }
111 106
112 - $this->add_control(
113 - 'header_size',
114 - [
115 - 'label' => esc_html__( 'HTML Tag', 'uicore-elements' ),
116 - 'type' => Controls_Manager::SELECT,
117 - 'options' => [
118 - 'h1' => 'H1',
119 - 'h2' => 'H2',
120 - 'h3' => 'H3',
121 - 'h4' => 'H4',
122 - 'h5' => 'H5',
123 - 'h6' => 'H6',
124 - 'div' => 'div',
125 - 'span' => 'span',
126 - 'p' => 'p',
127 - ],
128 - 'default' => 'h2',
129 - ]
130 - );
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 + );
131 123
132 - $this->add_responsive_control(
133 - 'align',
134 - [
135 - 'label' => esc_html__( 'Alignment', 'uicore-elements' ),
136 - 'type' => Controls_Manager::CHOOSE,
137 - 'options' => [
138 - 'left' => [
139 - 'title' => esc_html__( 'Left', 'uicore-elements' ),
140 - 'icon' => 'eicon-text-align-left',
141 - ],
142 - 'center' => [
143 - 'title' => esc_html__( 'Center', 'uicore-elements' ),
144 - 'icon' => 'eicon-text-align-center',
145 - ],
146 - 'right' => [
147 - 'title' => esc_html__( 'Right', 'uicore-elements' ),
148 - 'icon' => 'eicon-text-align-right',
149 - ],
150 - 'justify' => [
151 - 'title' => esc_html__( 'Justified', 'uicore-elements' ),
152 - 'icon' => 'eicon-text-align-justify',
153 - ],
154 - ],
155 - 'default' => '',
156 - 'selectors' => [
157 - '{{WRAPPER}}' => 'text-align: {{VALUE}};',
158 - ],
159 - ]
160 - );
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 + );
161 143
162 - $this->add_control(
163 - 'view',
164 - [
165 - 'label' => esc_html__( 'View', 'uicore-elements' ),
166 - 'type' => Controls_Manager::HIDDEN,
167 - 'default' => 'traditional',
168 - ]
169 - );
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 + );
170 173
171 - $this->end_controls_section();
174 + $this->add_control(
175 + 'view',
176 + [
177 + 'label' => esc_html__('View', 'uicore-elements'),
178 + 'type' => Controls_Manager::HIDDEN,
179 + 'default' => 'traditional',
180 + ]
181 + );
172 182
173 - $this->start_controls_section(
174 - 'section_title_style',
175 - [
176 - 'label' => esc_html__( 'Title', 'uicore-elements' ),
177 - 'tab' => Controls_Manager::TAB_STYLE,
178 - ]
179 - );
183 + $this->end_controls_section();
180 184
181 - $this->add_control(
182 - 'title_color',
183 - [
184 - 'label' => esc_html__( 'Text Color', 'uicore-elements' ),
185 - 'type' => Controls_Manager::COLOR,
186 - 'global' => [
187 - 'default' => Global_Colors::COLOR_PRIMARY,
188 - ],
189 - 'selectors' => [
190 - '{{WRAPPER}} .elementor-heading-title' => 'color: {{VALUE}};',
191 - ],
192 - ]
193 - );
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 + );
194 192
195 - $this->add_group_control(
196 - Group_Control_Typography::get_type(),
197 - [
198 - 'name' => 'typography',
199 - 'global' => [
200 - 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
201 - ],
202 - 'selector' => '{{WRAPPER}} .elementor-heading-title',
203 - ]
204 - );
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)',
205 199
206 - $this->add_group_control(
207 - Group_Control_Text_Stroke::get_type(),
208 - [
209 - 'name' => 'text_stroke',
210 - 'selector' => '{{WRAPPER}} .elementor-heading-title',
211 - ]
212 - );
200 + 'selectors' => [
201 + '{{WRAPPER}} .elementor-heading-title' => 'color: {{VALUE}};',
202 + ],
203 + ]
204 + );
213 205
214 - $this->add_group_control(
215 - Group_Control_Text_Shadow::get_type(),
216 - [
217 - 'name' => 'text_shadow',
218 - 'selector' => '{{WRAPPER}} .elementor-heading-title',
219 - ]
220 - );
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 + );
221 216
222 - $this->add_control(
223 - 'blend_mode',
224 - [
225 - 'label' => esc_html__( 'Blend Mode', 'uicore-elements' ),
226 - 'type' => Controls_Manager::SELECT,
227 - 'options' => [
228 - '' => esc_html__( 'Normal', 'uicore-elements' ),
229 - 'multiply' => 'Multiply',
230 - 'screen' => 'Screen',
231 - 'overlay' => 'Overlay',
232 - 'darken' => 'Darken',
233 - 'lighten' => 'Lighten',
234 - 'color-dodge' => 'Color Dodge',
235 - 'saturation' => 'Saturation',
236 - 'color' => 'Color',
237 - 'difference' => 'Difference',
238 - 'exclusion' => 'Exclusion',
239 - 'hue' => 'Hue',
240 - 'luminosity' => 'Luminosity',
241 - ],
242 - 'selectors' => [
243 - '{{WRAPPER}} .elementor-heading-title' => 'mix-blend-mode: {{VALUE}}',
244 - ],
245 - 'separator' => 'none',
246 - ]
247 - );
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 + );
248 224
249 - $this->end_controls_section();
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 + );
250 232
251 - }
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 + );
252 259
253 - /**
254 - * Render heading widget output on the frontend.
255 - *
256 - * Written in PHP and used to generate the final HTML.
257 - *
258 - * @since 1.0.0
259 - * @access protected
260 - */
261 - protected function render() {
262 - $settings = $this->get_settings_for_display();
260 + $this->end_controls_section();
261 + }
263 262
264 - $this->add_render_attribute( 'title', 'class', 'elementor-heading-title' );
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();
265 274
266 - if( !\Elementor\Plugin::$instance->editor->is_edit_mode() ) {
275 + $this->add_render_attribute('title', 'class', 'elementor-heading-title');
267 276
268 - // If there is a post.
269 - if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) {
270 - $title = single_post_title( '', false );
271 - }else{
272 - $title = wp_title(null,false);
273 - }
277 + if (!\Elementor\Plugin::$instance->editor->is_edit_mode()) {
274 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 + }
285 +
275 286 $title = $title ? $title : get_bloginfo('name');
276 - }else{
277 - $title = __( 'This is a dummy title.', 'uicore-elements' );
287 + } else {
288 + $title = __('This is a dummy title.', 'uicore-elements');
278 289 }
279 290
280 - $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));
281 292
282 - // PHPCS - the variable $title_html holds safe data.
283 - echo $title_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
284 - }
293 + // PHPCS - the variable $title_html holds safe data.
294 + echo $title_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
295 + }
285 296
286 - /**
287 - * Render heading widget output in the editor.
288 - *
289 - * Written as a Backbone JavaScript template and used to generate the live preview.
290 - *
291 - * @since 2.9.0
292 - * @access protected
293 - */
294 - protected function content_template() {
295 - }
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() {}
296 306 }
297 -\Elementor\Plugin::instance()->widgets_manager->register(new TheTitle());
307 +\Elementor\Plugin::instance()->widgets_manager->register(new TheTitle());