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