PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0.5.4
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0.5.4
4.3.2 4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 All 165 releases
adminify / Inc / Modules / DashboardWidget / DashboardWidget_Setttings.php

DashboardWidget_Setttings.php in Adminify – White Label, Admin Menu Editor, Login Customizer 4.0.5.4, at Inc/Modules/DashboardWidget/DashboardWidget_Setttings.php

692 lines 25.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Modules\DashboardWidget;
4
5 use WPAdminify\Inc\Utils;
6 // no direct access allowed
7 if (!defined('ABSPATH')) {
8 exit;
9 }
10
11 /**
12 * WPAdminify
13 *
14 * @package Module: Dashboard Widget
15 *
16 * @author Jewel Theme <support@jeweltheme.com>
17 */
18
19 if (!class_exists('DashboardWidget_Setttings')) {
20
21 class DashboardWidget_Setttings extends DashboardWidgetModel
22 {
23
24 public function __construct()
25 {
26 // this should be first so the default values get stored
27 $this->dashboard_widget_settings();
28 parent::__construct((array) get_option($this->prefix));
29
30 add_action('admin_enqueue_scripts', [$this, 'dash_widget_setting_css']);
31 }
32
33
34 /**
35 * Dashboard Admin Custom CSS
36 *
37 * @return void
38 */
39 public function dash_widget_setting_css()
40 {
41 $css = '
42 .adminify-dashboard-widgets .adminify-header{
43 margin-top:30px;
44 }
45 .adminify-dashboard-widgets .adminify-header-right{
46 padding: 25px;
47 }
48 .adminify-dashboard-widgets .wp-adminify-dashboard-widgets form{
49 background: #fff;
50 }
51 .adminify-dashboard-widgets .adminify-section .adminify-field-subheading{
52 background-color: transparent;
53 }';
54
55 printf('<style>body.wp-adminify{%s}</style>', wp_strip_all_tags($css));
56 }
57
58
59
60 public function get_defaults()
61 {
62 return [
63 'dashboard_widget_types' => [
64 'dashboard_widgets' => [
65 'title' => '',
66 'widget_pos' => 'normal',
67 'widget_type' => 'editor',
68 'dashw_video' => [
69 'dashw_type_video_type' => 'self_hosted',
70 'dashw_type_video_title' => '',
71 'dashw_type_video_type_self_hosted' => [
72 'url' => '',
73 'id' => '',
74 'width' => '',
75 'height' => '',
76 'thumbnail' => '',
77 'alt' => '',
78 'title' => '',
79 'description' => '',
80 ],
81 'dashw_type_video_type_youtube' => '',
82 'dashw_type_video_type_vimeo' => '',
83 'dashw_type_video_type_iframe' => '',
84 ],
85 'dashw_type_editor' => '',
86 'dashw_type_icon' => '',
87 'dashw_type_icon_tooltip' => '',
88 'dashw_type_icon_link' => [
89 'url' => 'https://wpadminify.com/',
90 'text' => __('WP Adminify', 'adminify'),
91 'target' => '_blank',
92 ],
93 'dashw_type_shortcode' => '',
94 'dashw_type_script' => '<script>
95 ;(function($) {
96 "use strict";
97 $(document).ready( function() {
98 // Write your JS code here
99 });
100 })( jQuery );
101 </script>',
102 'dashw_type_rss_feed' => '',
103 'dashw_type_rss_count' => 5,
104 'dashw_type_rss_excerpt' => true,
105 'dashw_type_rss_date' => true,
106 'dashw_type_rss_author' => true,
107 'user_roles' => '',
108
109 ],
110 'welcome_dash_widget' => [
111 'enable_custom_welcome_dash_widget' => false,
112 'widget_template_type' => 'specific_page',
113 'custom_page' => '',
114 'panel_height' => 600,
115 'elementor_section_id' => '',
116 'elementor_widget_id' => '',
117 'elementor_template_id' => '',
118 'oxygen_template_id' => '',
119 'dismissible' => true,
120 'user_roles' => '',
121 ],
122 ],
123 ];
124 }
125
126
127 /**
128 * Welcome Widget Settings
129 *
130 * @param [type] $welcome_widgets
131 *
132 * @return void
133 */
134 public function welcome_widgets_settings(&$welcome_widgets)
135 {
136 $welcome_widget_fields = [];
137 $this->welcome_widget_fields($welcome_widget_fields);
138 $welcome_widgets[] = [
139 'id' => 'welcome_dash_widget',
140 'type' => 'fieldset',
141 'class' => 'adminify-one-col',
142 'title' => '',
143 'fields' => $welcome_widget_fields,
144 ];
145 }
146
147 public function welcome_widget_fields(&$welcome_widget_fields)
148 {
149 $welcome_widget_fields[] = [
150 'id' => 'enable_custom_welcome_dash_widget',
151 'type' => 'switcher',
152 'title' => __('Enable Custom Welcome Panel?', 'adminify'),
153 'subtitle' => __('Enable if you want to show any Elementor Template/Page on Welcome Panel', 'adminify'),
154 'text_on' => __('Enable', 'adminify'),
155 'text_off' => __('Disable', 'adminify'),
156 'default' => $this->get_default_field('dashboard_widget_types')['welcome_dash_widget']['enable_custom_welcome_dash_widget'],
157 'text_width' => 100,
158 ];
159
160 // Default Page
161 $page_type_options = [
162 'specific_page' => __('Page', 'adminify'),
163 ];
164
165 // Oxygen Builder Support
166 if (Utils::is_plugin_active('oxygen/functions.php')) {
167 $page_oxygen_options = [];
168 $page_oxygen_options = [
169 'oxygen_template' => __('Oxygen Template', 'adminify'),
170 ];
171 $page_type_options = array_merge($page_type_options, $page_oxygen_options);
172 }
173
174 // Elementor Builder
175 if (Utils::is_plugin_active('elementor/elementor.php')) {
176 $page_elementory_options = [];
177 $page_elementory_options = [
178 'elementor_template' => __('Elementor Page Template', 'adminify'),
179 'elementor_section' => __('Elementor Saved Section', 'adminify'),
180 'elementor_widget' => __('Elementor Saved Widget', 'adminify'),
181 ];
182 $page_type_options = array_merge($page_type_options, $page_elementory_options);
183 }
184
185 $welcome_widget_fields[] = [
186 'id' => 'widget_template_type',
187 'type' => 'select',
188 'title' => __('Select Page/Template', 'adminify'),
189 'placeholder' => __('Select an option', 'adminify'),
190 'options' => $page_type_options,
191 'default' => $this->get_default_field('dashboard_widget_types')['welcome_dash_widget']['widget_template_type'],
192 'dependency' => ['enable_custom_welcome_dash_widget', '==', 'true', true],
193 ];
194
195 // Default Page
196 $welcome_widget_fields[] = [
197 'id' => 'custom_page',
198 'type' => 'select',
199 'title' => __('Select Page', 'adminify'),
200 'placeholder' => __('Select a Page', 'adminify'),
201 'options' => 'pages',
202 'default' => $this->get_default_field('dashboard_widget_types')['welcome_dash_widget']['custom_page'],
203 'dependency' => ['widget_template_type|enable_custom_welcome_dash_widget', '==|==', 'specific_page|true', true],
204 ];
205
206
207 $welcome_widget_fields[] = [
208 'id' => 'panel_height',
209 'type' => 'number',
210 'title' => __('Panel Height', 'adminify'),
211 'unit' => 'px',
212 'default' => 100,
213 'default' => $this->get_default_field('dashboard_widget_types')['welcome_dash_widget']['panel_height'],
214 'dependency' => ['widget_template_type|enable_custom_welcome_dash_widget', '==|==', 'specific_page|true', true],
215 ];
216
217 // Oxygen Builder
218 if (Utils::is_plugin_active('oxygen/functions.php')) {
219 $welcome_widget_fields[] = [
220 'id' => 'oxygen_template_id',
221 'type' => 'select',
222 'title' => __('Select Template', 'adminify'),
223 'placeholder' => __('Select a Template', 'adminify'),
224 'options' => 'posts',
225 'query_args' => [
226 'post_type' => 'ct_template',
227 ],
228 'default' => $this->get_default_field('dashboard_widget_types')['welcome_dash_widget']['oxygen_template_id'],
229 'dependency' => ['widget_template_type|enable_custom_welcome_dash_widget', '==|==', 'oxygen_template|true', true],
230 ];
231 }
232
233 // Elementor Builder
234 if (Utils::is_plugin_active('elementor/elementor.php')) {
235 $welcome_widget_fields[] = [
236 'id' => 'elementor_section_id',
237 'type' => 'select',
238 'title' => __('Saved Section', 'adminify'),
239 'options' => 'WPAdminify\Inc\Utils::get_section_template_options',
240 'default' => $this->get_default_field('dashboard_widget_types')['welcome_dash_widget']['elementor_section_id'],
241 'dependency' => ['widget_template_type|enable_custom_welcome_dash_widget', '==|==', 'elementor_section|true', true],
242 ];
243
244 $welcome_widget_fields[] = [
245 'id' => 'elementor_widget_id',
246 'type' => 'select',
247 'title' => __('Saved Widget', 'adminify'),
248 'options' => 'WPAdminify\Inc\Utils::get_widget_template_options',
249 'default' => $this->get_default_field('dashboard_widget_types')['welcome_dash_widget']['elementor_widget_id'],
250 'dependency' => ['widget_template_type|enable_custom_welcome_dash_widget', '==|==', 'elementor_widget|true', true],
251 ];
252
253 $welcome_widget_fields[] = [
254 'id' => 'elementor_template_id',
255 'type' => 'select',
256 'title' => __('Saved Template', 'adminify'),
257 'options' => 'WPAdminify\Inc\Utils::get_page_template_options',
258 'default' => $this->get_default_field('dashboard_widget_types')['welcome_dash_widget']['elementor_template_id'],
259 'dependency' => ['widget_template_type|enable_custom_welcome_dash_widget', '==|==', 'elementor_template|true', true],
260 ];
261 }
262
263
264 $welcome_widget_fields[] = [
265 'id' => 'dismissible',
266 'type' => 'switcher',
267 'title' => sprintf(__('Dismissible %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
268 'class' => 'adminify-pro-fieldset adminify-pro-notice',
269 'default' => $this->get_default_field('dashboard_widget_types')['welcome_dash_widget']['dismissible'],
270 'dependency' => ['enable_custom_welcome_dash_widget', '==', 'true', true],
271 ];
272
273 $welcome_widget_fields[] = [
274 'id' => 'user_roles',
275 'type' => 'select',
276 'title' => __('Allowed User Roles', 'adminify'),
277 'subtitle' => __('Allow users to access this section', 'adminify'),
278 'placeholder' => __('Select a role', 'adminify'),
279 'chosen' => true,
280 'multiple' => true,
281 'options' => 'roles',
282 'default' => $this->get_default_field('dashboard_widget_types')['welcome_dash_widget']['user_roles'],
283 'dependency' => ['enable_custom_welcome_dash_widget', '==', 'true', true],
284 ];
285 }
286
287 /**
288 * Dashboard Widgets Setting
289 *
290 * @param [type] $dash_widgets_setting
291 *
292 * @return void
293 */
294 public function dash_widget_setting_setup(&$dash_widgets_setting)
295 {
296 $dash_widgets = [];
297 $this->dashboard_widgets($dash_widgets);
298
299 $welcome_widgets = [];
300 $this->welcome_widgets_settings($welcome_widgets);
301
302 $dash_widgets_setting[] = [
303 'type' => 'subheading',
304 'id' => 'dashboard_widget_types_subheading',
305 'content' => Utils::adminfiy_help_urls(
306 __('Custom Dashboard & Welcome Widgets', 'adminify'),
307 'https://wpadminify.com/kb/wordpress-custom-dashboard-widget',
308 'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
309 'https://www.facebook.com/groups/jeweltheme',
310 \WPAdminify\Inc\Admin\AdminSettings::support_url()
311 ),
312 ];
313
314 $dash_widgets_setting[] = [
315 'id' => 'dashboard_widget_types',
316 'type' => 'tabbed',
317 'title' => '',
318 'tabs' => [
319 [
320 'title' => __('Dashboard Widgets', 'adminify'),
321 'id' => 'dashboard_widgets_tab',
322 'fields' => $dash_widgets,
323 ],
324
325 [
326 'title' => __('Welcome Widget', 'adminify'),
327 'id' => 'welcome_widgets_tab',
328 'fields' => $welcome_widgets,
329 ],
330
331 ],
332 ];
333 }
334
335 /**
336 * Dashboard Widgets Section
337 *
338 * @param [type] $dash_widgets
339 *
340 * @return void
341 */
342 public function dashboard_widgets(&$dash_widgets)
343 {
344 $dashboard_group_fields = [];
345 $this->dashboard_widget_group_fields($dashboard_group_fields);
346
347 $dash_widgets[] = [
348 'id' => 'dashboard_widgets',
349 'type' => 'group',
350 'title' => '',
351 'max' => 2,
352 'max_text' => __('Get <strong>Pro Version</strong> to Unlock this feature. <a href="https://wpadminify.com/pricing" target="_blank">Upgrade to Pro Now!</a>', 'adminify'),
353 'accordion_title_title' => __('Dashboard Widget Name:', 'adminify'),
354 'accordion_title_prefix' => __('Dashboard Widget Name: ', 'adminify'),
355 'accordion_title_number' => true,
356 'accordion_title_auto' => true,
357 'button_title' => __('Add New Widget', 'adminify'),
358 'fields' => $dashboard_group_fields,
359 ];
360 }
361
362
363 public function dashboard_widget_group_fields(&$dashboard_group_fields)
364 {
365 $dashboard_widget_video = [];
366 $this->dashboard_widget_video($dashboard_widget_video);
367
368 $dashboard_group_fields[] = [
369 'id' => 'title',
370 'type' => 'text',
371 'title' => __('Widget Title', 'adminify'),
372 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['title'],
373 ];
374
375 $dashboard_group_fields[] = [
376 'id' => 'widget_pos',
377 'type' => 'button_set',
378 'title' => __('Widget Position', 'adminify'),
379 'options' => [
380 'side' => __('Side', 'adminify'),
381 'normal' => __('Normal', 'adminify'),
382 ],
383 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['widget_pos'],
384 ];
385
386 $dashboard_group_fields[] = [
387 'id' => 'widget_type',
388 'type' => 'button_set',
389 'title' => __('Content Type', 'adminify'),
390 'options' => [
391 'editor' => __('Editor', 'adminify'),
392 'icon' => __('Icon', 'adminify'),
393 'video' => __('Video', 'adminify'),
394 'shortcode' => __('Shortcode', 'adminify'),
395 'rss_feed' => __('RSS Feed', 'adminify'),
396 'script' => __('Script', 'adminify'),
397 ],
398 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['widget_type'],
399 ];
400
401 $dashboard_group_fields[] = [
402 'id' => 'dashw_video',
403 'type' => 'fieldset',
404 'title' => __('Video', 'adminify'),
405 'fields' => $dashboard_widget_video,
406 'dependency' => ['widget_type', '==', 'video'],
407 ];
408
409 $dashboard_group_fields[] = [
410 'id' => 'dashw_type_editor',
411 'type' => 'wp_editor',
412 'title' => __('Content', 'adminify'),
413 'subtitle' => __('Contents with Editor and HTML mode', 'adminify'),
414 'height' => '100px',
415 'dependency' => ['widget_type', '==', 'editor'],
416 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_editor'],
417 ];
418
419
420 $dashboard_group_fields[] = [
421 'id' => 'dashw_type_icon',
422 'type' => 'icon',
423 'title' => sprintf(__('Icon %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
424 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
425 'dependency' => ['widget_type', '==', 'icon'],
426 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_icon'],
427 ];
428
429 $dashboard_group_fields[] = [
430 'id' => 'dashw_type_icon_tooltip',
431 'type' => 'text',
432 'title' => sprintf(__('Tooltip Text %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
433 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
434 'dependency' => ['widget_type', '==', 'icon'],
435 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_icon_tooltip'],
436 ];
437
438
439 $dashboard_group_fields[] = [
440 'id' => 'dashw_type_icon_link',
441 'type' => 'link',
442 'title' => sprintf(__('Link %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
443 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
444 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_icon_link'],
445 'dependency' => ['widget_type', '==', 'icon'],
446 ];
447
448
449 $dashboard_group_fields[] = [
450 'id' => 'dashw_type_shortcode',
451 'type' => 'textarea',
452 'title' => sprintf(__('Shortcode %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
453 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
454 'dependency' => ['widget_type', '==', 'shortcode'],
455 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_shortcode'],
456 ];
457
458
459 $dashboard_group_fields[] = [
460 'id' => 'dashw_type_script',
461 'type' => 'code_editor',
462 'title' => sprintf(__('Script %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
463 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
464 'subtitle' => __('Write Custom Script code inside <strong>&lt;script&gt;&lt;/script&gt;</strong> tag.', 'adminify'),
465 'settings' => [
466 'theme' => 'dracula',
467 'mode' => 'htmlmixed',
468 ],
469 'sanitize' => false,
470 'dependency' => ['widget_type', '==', 'script'],
471 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_script'],
472 ];
473
474 $dashboard_group_fields[] = [
475 'id' => 'dashw_type_rss_feed',
476 'type' => 'text',
477 'title' => sprintf(__('RSS Feed URL %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
478 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
479 'dependency' => ['widget_type', '==', 'rss_feed'],
480 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_rss_feed'],
481 ];
482
483 $dashboard_group_fields[] = [
484 'id' => 'dashw_type_rss_count',
485 'type' => 'number',
486 'title' => sprintf(__('No. of Feed Posts %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
487 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
488 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_rss_count'],
489 'dependency' => ['widget_type', '==', 'rss_feed'],
490 ];
491
492 $dashboard_group_fields[] = [
493 'id' => 'dashw_type_rss_excerpt',
494 'type' => 'switcher',
495 'title' => sprintf(__('Show Excerpt? %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
496 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
497 'text_on' => __('Yes', 'adminify'),
498 'text_off' => __('No', 'adminify'),
499 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_rss_excerpt'],
500 'dependency' => ['widget_type', '==', 'rss_feed'],
501 ];
502
503 $dashboard_group_fields[] = [
504 'id' => 'dashw_type_rss_date',
505 'type' => 'switcher',
506 'title' => sprintf(__('Show Date? %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
507 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
508 'text_on' => __('Yes', 'adminify'),
509 'text_off' => __('No', 'adminify'),
510 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_rss_date'],
511 'dependency' => ['widget_type', '==', 'rss_feed'],
512 ];
513
514
515 $dashboard_group_fields[] = [
516 'id' => 'dashw_type_rss_author',
517 'type' => 'switcher',
518 'title' => sprintf(__('Show Author? %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
519 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
520 'text_on' => __('Yes', 'adminify'),
521 'text_off' => __('No', 'adminify'),
522 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_type_rss_author'],
523 'dependency' => ['widget_type', '==', 'rss_feed'],
524 ];
525
526
527 $dashboard_group_fields[] = [
528 'id' => 'user_roles',
529 'type' => 'select',
530 'title' => __('Allowed User Roles', 'adminify'),
531 'subtitle' => __('Allow users to access this section', 'adminify'),
532 'placeholder' => __('Select a role', 'adminify'),
533 'chosen' => true,
534 'multiple' => true,
535 'options' => 'roles',
536 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['user_roles'],
537 ];
538 }
539
540 public function dashboard_widget_video(&$dashboard_widget_video)
541 {
542 $dashboard_widget_video[] = [
543 'id' => 'dashw_type_video_type',
544 'type' => 'button_set',
545 'title' => __('Video Type', 'adminify'),
546 'options' => [
547 'self_hosted' => __('Self Hosted ', 'adminify'),
548 'youtube' => __('Youtube', 'adminify'),
549 'vimeo' => __('Vimeo', 'adminify'),
550 'iframe' => __('iFrame', 'adminify'),
551 ],
552 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_video']['dashw_type_video_type'],
553 ];
554
555
556 $dashboard_widget_video[] = [
557 'id' => 'dashw_type_video_title',
558 'type' => 'text',
559 'title' => sprintf(__('Text %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
560 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
561 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_video']['dashw_type_video_title'],
562 'dependency' => ['dashw_type_video_type', '!==', 'iframe', true],
563 ];
564
565
566 $dashboard_widget_video[] = [
567 'id' => 'dashw_type_video_type_self_hosted',
568 'type' => 'media',
569 'title' => sprintf(__('Upload Video %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
570 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
571 'library' => 'video',
572 'preview' => true,
573 'dependency' => ['dashw_type_video_type', '==', 'self_hosted'],
574 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_video']['dashw_type_video_type_self_hosted'],
575 ];
576
577 $dashboard_widget_video[] = [
578 'id' => 'dashw_type_video_type_youtube',
579 'type' => 'text',
580 'title' => sprintf(__('Youtube URL %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
581 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
582 'validate' => 'adminify_validate_url',
583 'dependency' => ['dashw_type_video_type', '==', 'youtube'],
584 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_video']['dashw_type_video_type_youtube'],
585 ];
586
587 $dashboard_widget_video[] = [
588 'id' => 'dashw_type_video_type_vimeo',
589 'type' => 'text',
590 'title' => sprintf(__('Vimeo URL %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
591 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
592 'validate' => 'adminify_validate_url',
593 'dependency' => ['dashw_type_video_type', '==', 'vimeo'],
594 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_video']['dashw_type_video_type_vimeo'],
595 ];
596
597 $dashboard_widget_video[] = [
598 'id' => 'dashw_type_video_type_iframe',
599 'type' => 'text',
600 'title' => sprintf(__('iFrame Video URL %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
601 'class' => 'adminify-pro-fieldset adminify-pro-notice adminify-pro-pointer',
602 'validate' => 'adminify_validate_url',
603 'dependency' => ['dashw_type_video_type', '==', 'iframe'],
604 'default' => $this->get_default_field('dashboard_widget_types')['dashboard_widgets']['dashw_video']['dashw_type_video_type_iframe'],
605 ];
606 }
607
608 public function dashboard_widget_settings()
609 {
610 if (!class_exists('ADMINIFY')) {
611 return;
612 }
613
614 // WP Adminify Dashboard Widgets Settings
615 \ADMINIFY::createOptions(
616 $this->prefix,
617 [
618
619 // Framework Title
620 'framework_title' => __('WP Adminify Dashboard Widget <small>by Jewel Theme</small>', 'adminify'),
621 'framework_class' => 'adminify-dashboard-widgets',
622
623 // menu settings
624 'menu_title' => __('Dashboard Widget', 'adminify'),
625 'menu_slug' => 'adminify-dashboard-widgets',
626 'menu_type' => 'submenu', // menu, submenu, options, theme, etc.
627 'menu_capability' => 'manage_options',
628 'menu_icon' => '',
629 'menu_position' => 18,
630 'menu_hook_priority' => 21,
631 'menu_hidden' => false,
632 'menu_parent' => 'wp-adminify-settings',
633
634 // footer
635 'footer_text' => ' ',
636 'footer_after' => ' ',
637 'footer_credit' => ' ',
638
639 // menu extras
640 'show_bar_menu' => false,
641 'show_sub_menu' => false,
642 'show_in_network' => false,
643 'show_in_customizer' => false,
644
645 'show_search' => false,
646 'show_reset_all' => false,
647 'show_reset_section' => false,
648 'show_footer' => true,
649 'show_all_options' => true,
650 'show_form_warning' => true,
651 'sticky_header' => false,
652 'save_defaults' => false,
653 'ajax_save' => true,
654
655 // admin bar menu settings
656 'admin_bar_menu_icon' => '',
657 'admin_bar_menu_priority' => 45,
658
659 // database model
660 'database' => 'options', // options, transient, theme_mod, network(multisite support)
661 'transient_time' => 0,
662
663 // typography options
664 'enqueue_webfont' => true,
665 'async_webfont' => false,
666
667 // others
668 'output_css' => false,
669
670 // theme and wrapper classname
671 'nav' => 'normal',
672 'theme' => 'dark',
673 'class' => 'wp-adminify-dashboard-widgets',
674 ]
675 );
676
677 $dash_widgets_setting = [];
678 $this->dash_widget_setting_setup($dash_widgets_setting);
679 $dash_widgets_setting = apply_filters('adminify_settings/dashboar_widgets', $dash_widgets_setting, $this);
680
681 \ADMINIFY::createSection(
682 $this->prefix,
683 [
684 'title' => __('Dashboard Widget', 'adminify'),
685 'icon' => 'fas fa-bolt',
686 'fields' => $dash_widgets_setting,
687 ]
688 );
689 }
690 }
691 }
692