| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Modules\SidebarGenerator; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils; |
| 6 |
// no direct access allowed |
| 7 |
if (!defined('ABSPATH')) exit; |
| 8 |
|
| 9 |
/** |
| 10 |
* WPAdminify |
| 11 |
* @package Module: Sidebar Generator |
| 12 |
* |
| 13 |
* @author Jewel Theme <support@jeweltheme.com> |
| 14 |
*/ |
| 15 |
|
| 16 |
class Sidebar_Generator_Settings extends Sidebar_Generator_Model |
| 17 |
{ |
| 18 |
public function __construct() |
| 19 |
{ |
| 20 |
// this should be first so the default values get stored |
| 21 |
$this->sidebar_generator_settings(); |
| 22 |
parent::__construct((array) get_option($this->prefix)); |
| 23 |
} |
| 24 |
|
| 25 |
|
| 26 |
protected function get_defaults() |
| 27 |
{ |
| 28 |
return [ |
| 29 |
'sidebar_title' => '', |
| 30 |
'sidebar_desc' => '', |
| 31 |
]; |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
public function get_sidebar_fields(&$sidebar_fields) |
| 36 |
{ |
| 37 |
$sidebar_fields[] = array( |
| 38 |
'id' => 'sidebar_title', |
| 39 |
'type' => 'text', |
| 40 |
'title' => __('Sidebar Name', WP_ADMINIFY_TD), |
| 41 |
'default' => $this->get_default_field('sidebar_title'), |
| 42 |
); |
| 43 |
$sidebar_fields[] = array( |
| 44 |
'id' => 'sidebar_desc', |
| 45 |
'type' => 'textarea', |
| 46 |
'title' => __('Sidebar Description', WP_ADMINIFY_TD), |
| 47 |
'default' => $this->get_default_field('sidebar_title'), |
| 48 |
); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Sidebar Generator Settings |
| 53 |
* |
| 54 |
* @return void |
| 55 |
*/ |
| 56 |
public function sidebar_generator_settings() |
| 57 |
{ |
| 58 |
if (!class_exists('ADMINIFY')) { |
| 59 |
return; |
| 60 |
} |
| 61 |
// WP Adminify Sidebar Generator Settings |
| 62 |
\ADMINIFY::createOptions($this->prefix, array( |
| 63 |
|
| 64 |
// Framework Title |
| 65 |
'framework_title' => 'WP Adminify Sidebar Generator <small>by WP Adminify</small>', |
| 66 |
'framework_class' => 'wp-adminify-sidebar-generator', |
| 67 |
|
| 68 |
// menu settings |
| 69 |
'menu_title' => 'Sidebar Generator', |
| 70 |
'menu_slug' => 'wp-adminify-sidebar-generator', |
| 71 |
'menu_type' => 'submenu', // menu, submenu, options, theme, etc. |
| 72 |
'menu_capability' => 'manage_options', |
| 73 |
'menu_icon' => '', |
| 74 |
'menu_position' => 59, |
| 75 |
'menu_hidden' => false, |
| 76 |
'menu_parent' => 'wp-adminify-settings', |
| 77 |
|
| 78 |
// footer |
| 79 |
'footer_text' => ' ', |
| 80 |
'footer_after' => ' ', |
| 81 |
'footer_credit' => ' ', |
| 82 |
|
| 83 |
// menu extras |
| 84 |
'show_bar_menu' => false, |
| 85 |
'show_sub_menu' => true, |
| 86 |
'show_in_network' => false, |
| 87 |
'show_in_customizer' => false, |
| 88 |
|
| 89 |
'show_search' => false, |
| 90 |
'show_reset_all' => false, |
| 91 |
'show_reset_section' => false, |
| 92 |
'show_footer' => true, |
| 93 |
'show_all_options' => true, |
| 94 |
'show_form_warning' => true, |
| 95 |
'sticky_header' => false, |
| 96 |
'save_defaults' => true, |
| 97 |
'ajax_save' => true, |
| 98 |
|
| 99 |
// admin bar menu settings |
| 100 |
'admin_bar_menu_icon' => '', |
| 101 |
'admin_bar_menu_priority' => 45, |
| 102 |
|
| 103 |
|
| 104 |
// database model |
| 105 |
'database' => 'options', // options, transient, theme_mod, network(multisite support) |
| 106 |
'transient_time' => 0, |
| 107 |
|
| 108 |
|
| 109 |
// typography options |
| 110 |
'enqueue_webfont' => true, |
| 111 |
'async_webfont' => false, |
| 112 |
|
| 113 |
// others |
| 114 |
'output_css' => false, |
| 115 |
|
| 116 |
// theme and wrapper classname |
| 117 |
'nav' => 'normal', |
| 118 |
'theme' => 'dark', |
| 119 |
'class' => 'wp-adminify-sidebar-generator', |
| 120 |
)); |
| 121 |
|
| 122 |
$sidebar_fields = []; |
| 123 |
$this->get_sidebar_fields($sidebar_fields); |
| 124 |
|
| 125 |
\ADMINIFY::createSection( |
| 126 |
$this->prefix, |
| 127 |
array( |
| 128 |
'title' => __('Sidebar Generator', WP_ADMINIFY_TD), |
| 129 |
'icon' => 'fas fa-bolt', |
| 130 |
'fields' => array( |
| 131 |
array( |
| 132 |
'type' => 'subheading', |
| 133 |
'content' => Utils::adminfiy_help_urls( |
| 134 |
__('Custom Sidebar Generator', WP_ADMINIFY_TD), |
| 135 |
'https://wpadminify.com/kb/wordpress-custom-sidebar', |
| 136 |
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8', |
| 137 |
'https://www.facebook.com/groups/jeweltheme', |
| 138 |
'https://wpadminify.com/support/wp-adminify' |
| 139 |
) |
| 140 |
), |
| 141 |
array( |
| 142 |
'id' => 'sidebars', |
| 143 |
'type' => 'group', |
| 144 |
'title' => '', |
| 145 |
'accordion_title_prefix' => __('Sidebar Name: ', WP_ADMINIFY_TD), |
| 146 |
'accordion_title_number' => true, |
| 147 |
'accordion_title_auto' => true, |
| 148 |
'button_title' => __('Add New Sidebar', WP_ADMINIFY_TD), |
| 149 |
'fields' => $sidebar_fields |
| 150 |
), |
| 151 |
) |
| 152 |
) |
| 153 |
); |
| 154 |
} |
| 155 |
} |
| 156 |
|