| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Admin\Options; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettingsModel; |
| 7 |
|
| 8 |
if (!defined('ABSPATH')) { |
| 9 |
die; |
| 10 |
} // Cannot access directly. |
| 11 |
|
| 12 |
class DashboardWidgets extends AdminSettingsModel |
| 13 |
{ |
| 14 |
public function __construct() |
| 15 |
{ |
| 16 |
$this->dasboard_widgets_settings(); |
| 17 |
} |
| 18 |
|
| 19 |
public function get_defaults() |
| 20 |
{ |
| 21 |
return [ |
| 22 |
'dashboard_widgets' => [ |
| 23 |
'dashboard_widgets_user_roles' => [], |
| 24 |
'dashboard_widgets_list' => [] |
| 25 |
] |
| 26 |
]; |
| 27 |
} |
| 28 |
|
| 29 |
public function dasboard_widgets_settings() |
| 30 |
{ |
| 31 |
|
| 32 |
if (!class_exists('ADMINIFY')) { |
| 33 |
return; |
| 34 |
} |
| 35 |
|
| 36 |
// Dashboard Widgets Section |
| 37 |
\ADMINIFY::createSection($this->prefix, array( |
| 38 |
'title' => __('Dashboard Widgets', WP_ADMINIFY_TD), |
| 39 |
'icon' => 'dashicons dashicons-dashboard', |
| 40 |
'parent' => 'widget_settings', |
| 41 |
'id' => 'dashboard_widgets', |
| 42 |
'fields' => array( |
| 43 |
array( |
| 44 |
'type' => 'subheading', |
| 45 |
'content' => Utils::adminfiy_help_urls( |
| 46 |
__('Dashboard Widgets Settings', WP_ADMINIFY_TD), |
| 47 |
'https://wpadminify.com/kb/wp-widget-settings/', |
| 48 |
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8', |
| 49 |
'https://www.facebook.com/groups/jeweltheme', |
| 50 |
'https://wpadminify.com/support/' |
| 51 |
) |
| 52 |
), |
| 53 |
array( |
| 54 |
'id' => 'dashboard_widgets_user_roles', |
| 55 |
'type' => 'select', |
| 56 |
'title' => __('Visible for', WP_ADMINIFY_TD), |
| 57 |
'placeholder' => __('Select User roles you want to show', WP_ADMINIFY_TD), |
| 58 |
'options' => 'roles', |
| 59 |
'multiple' => true, |
| 60 |
'chosen' => true, |
| 61 |
'default' => $this->get_default_field('dashboard_widgets')['dashboard_widgets_user_roles'], |
| 62 |
), |
| 63 |
array( |
| 64 |
'id' => 'dashboard_widgets_list', |
| 65 |
'type' => 'checkbox', |
| 66 |
'title' => __('Remove unwanted Widgets', WP_ADMINIFY_TD), |
| 67 |
'options' => '\WPAdminify\Inc\Classes\DashboardWidgets::render_dashboard_checkboxes', |
| 68 |
'default' => $this->get_default_field('dashboard_widgets')['dashboard_widgets_list'], |
| 69 |
) |
| 70 |
|
| 71 |
) |
| 72 |
)); |
| 73 |
} |
| 74 |
} |
| 75 |
|