| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Admin\Options; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils ; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettingsModel ; |
| 7 |
if ( !defined( 'ABSPATH' ) ) { |
| 8 |
die; |
| 9 |
} |
| 10 |
// Cannot access directly. |
| 11 |
class General_Layout_Mode extends AdminSettingsModel |
| 12 |
{ |
| 13 |
public function __construct() |
| 14 |
{ |
| 15 |
$this->general_layout_mode_settings(); |
| 16 |
} |
| 17 |
|
| 18 |
public function get_defaults() |
| 19 |
{ |
| 20 |
return [ |
| 21 |
'admin_bar_mode' => 'light', |
| 22 |
'admin_bar_logo_type' => 'image_logo', |
| 23 |
'admin_bar_light_mode' => [ |
| 24 |
'admin_bar_light_logo_text' => __( 'WP Adminify', 'adminify' ), |
| 25 |
'admin_bar_light_logo_text_typo' => '', |
| 26 |
'admin_bar_light_logo' => '', |
| 27 |
'light_logo_size' => [ |
| 28 |
'width' => '150', |
| 29 |
'height' => '45', |
| 30 |
'unit' => 'px', |
| 31 |
], |
| 32 |
], |
| 33 |
'admin_bar_dark_mode' => [ |
| 34 |
'admin_bar_dark_logo_text' => __( 'WP Adminify', 'adminify' ), |
| 35 |
'admin_bar_dark_logo_text_typo' => '', |
| 36 |
'admin_bar_dark_logo' => '', |
| 37 |
'dark_logo_size' => [ |
| 38 |
'width' => '150', |
| 39 |
'height' => '45', |
| 40 |
'unit' => 'px', |
| 41 |
], |
| 42 |
], |
| 43 |
'enable_schedule_dark_mode' => false, |
| 44 |
'gutenberg_editor_logo' => '', |
| 45 |
'schedule_dark_mode_type' => 'system', |
| 46 |
'schedule_dark_mode_start_time' => '', |
| 47 |
'schedule_dark_mode_end_time' => '', |
| 48 |
]; |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Logo Options Settings |
| 53 |
* |
| 54 |
* @return void |
| 55 |
*/ |
| 56 |
public function layout_mode_setting_fields( &$fields ) |
| 57 |
{ |
| 58 |
$fields[] = [ |
| 59 |
'type' => 'subheading', |
| 60 |
'content' => Utils::adminfiy_help_urls( |
| 61 |
__( 'Logo Options Settings', 'adminify' ), |
| 62 |
'https://wpadminify.com/kb/configure-wordpress-dashboard-dark-mode/', |
| 63 |
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8', |
| 64 |
'https://www.facebook.com/groups/jeweltheme', |
| 65 |
'https://wpadminify.com/support/' |
| 66 |
), |
| 67 |
]; |
| 68 |
$fields[] = [ |
| 69 |
'id' => 'admin_bar_mode', |
| 70 |
'type' => 'button_set', |
| 71 |
'title' => __( 'Color Mode', 'adminify' ), |
| 72 |
'options' => [ |
| 73 |
'light' => __( 'Light Mode', 'adminify' ), |
| 74 |
'dark' => __( 'Dark Mode', 'adminify' ), |
| 75 |
], |
| 76 |
'default' => $this->get_default_field( 'admin_bar_mode' ), |
| 77 |
]; |
| 78 |
$fields[] = [ |
| 79 |
'id' => 'admin_bar_logo_type', |
| 80 |
'type' => 'button_set', |
| 81 |
'title' => __( 'Logo Type', 'adminify' ), |
| 82 |
'options' => [ |
| 83 |
'image_logo' => __( 'Image', 'adminify' ), |
| 84 |
'text_logo' => __( 'Text', 'adminify' ), |
| 85 |
], |
| 86 |
'default' => $this->get_default_field( 'admin_bar_logo_type' ), |
| 87 |
'dependency' => [ |
| 88 |
'admin_ui', |
| 89 |
'==', |
| 90 |
'true', |
| 91 |
'true' |
| 92 |
], |
| 93 |
]; |
| 94 |
$fields[] = [ |
| 95 |
'id' => 'admin_bar_light_mode', |
| 96 |
'type' => 'fieldset', |
| 97 |
'fields' => [ |
| 98 |
[ |
| 99 |
'id' => 'admin_bar_light_logo_text', |
| 100 |
'type' => 'text', |
| 101 |
'title' => __( 'Logo Text', 'adminify' ), |
| 102 |
'dependency' => [ |
| 103 |
'admin_bar_logo_type', |
| 104 |
'==', |
| 105 |
'text_logo', |
| 106 |
'true' |
| 107 |
], |
| 108 |
'default' => $this->get_default_field( 'admin_bar_light_mode' )['admin_bar_light_logo_text'], |
| 109 |
], |
| 110 |
[ |
| 111 |
'id' => 'admin_bar_light_logo_text_typo', |
| 112 |
'type' => 'typography', |
| 113 |
'title' => __( 'Logo Text Typography', 'adminify' ), |
| 114 |
'font_family' => true, |
| 115 |
'font_weight' => true, |
| 116 |
'font_style' => true, |
| 117 |
'font_size' => true, |
| 118 |
'line_height' => true, |
| 119 |
'letter_spacing' => true, |
| 120 |
'text_align' => false, |
| 121 |
'text-transform' => true, |
| 122 |
'color' => true, |
| 123 |
'subset' => false, |
| 124 |
'word_spacing' => true, |
| 125 |
'text_decoration' => true, |
| 126 |
'dependency' => [ |
| 127 |
'admin_bar_logo_type', |
| 128 |
'==', |
| 129 |
'text_logo', |
| 130 |
'true' |
| 131 |
], |
| 132 |
'default' => $this->get_default_field( 'admin_bar_light_mode' )['admin_bar_light_logo_text_typo'], |
| 133 |
], |
| 134 |
[ |
| 135 |
'id' => 'admin_bar_light_logo', |
| 136 |
'type' => 'media', |
| 137 |
'title' => __( 'Light Logo', 'adminify' ), |
| 138 |
'library' => 'image', |
| 139 |
'preview_size' => 'thumbnail', |
| 140 |
'button_title' => __( 'Add Light Logo', 'adminify' ), |
| 141 |
'remove_title' => __( 'Remove Light Logo', 'adminify' ), |
| 142 |
'default' => $this->get_default_field( 'admin_bar_light_mode' )['admin_bar_light_logo'], |
| 143 |
'dependency' => [ |
| 144 |
'admin_bar_logo_type', |
| 145 |
'==', |
| 146 |
'image_logo', |
| 147 |
'true' |
| 148 |
], |
| 149 |
], |
| 150 |
[ |
| 151 |
'id' => 'light_logo_size', |
| 152 |
'type' => 'dimensions', |
| 153 |
'title' => __( 'Logo Size', 'adminify' ), |
| 154 |
'default' => $this->get_default_field( 'admin_bar_light_mode' )['light_logo_size'], |
| 155 |
'dependency' => [ |
| 156 |
'admin_bar_logo_type', |
| 157 |
'==', |
| 158 |
'image_logo', |
| 159 |
'true' |
| 160 |
], |
| 161 |
] |
| 162 |
], |
| 163 |
'dependency' => [ |
| 164 |
'admin_ui|admin_bar_mode', |
| 165 |
'==|==', |
| 166 |
'true|light', |
| 167 |
'true' |
| 168 |
], |
| 169 |
]; |
| 170 |
$fields[] = [ |
| 171 |
'id' => 'admin_bar_dark_mode', |
| 172 |
'type' => 'fieldset', |
| 173 |
'fields' => [ |
| 174 |
[ |
| 175 |
'id' => 'admin_bar_dark_logo_text', |
| 176 |
'type' => 'text', |
| 177 |
'title' => __( 'Logo Text', 'adminify' ), |
| 178 |
'default' => $this->get_default_field( 'admin_bar_dark_mode' )['admin_bar_dark_logo_text'], |
| 179 |
'dependency' => [ |
| 180 |
'admin_bar_logo_type', |
| 181 |
'==', |
| 182 |
'text_logo', |
| 183 |
'true' |
| 184 |
], |
| 185 |
], |
| 186 |
[ |
| 187 |
'id' => 'admin_bar_dark_logo_text_typo', |
| 188 |
'type' => 'typography', |
| 189 |
'title' => __( 'Logo Text Typography', 'adminify' ), |
| 190 |
'font_family' => true, |
| 191 |
'font_weight' => true, |
| 192 |
'font_style' => true, |
| 193 |
'font_size' => true, |
| 194 |
'line_height' => true, |
| 195 |
'letter_spacing' => true, |
| 196 |
'text_align' => false, |
| 197 |
'text-transform' => true, |
| 198 |
'color' => true, |
| 199 |
'subset' => false, |
| 200 |
'backup_font_family' => false, |
| 201 |
'font_variant' => false, |
| 202 |
'word_spacing' => true, |
| 203 |
'text_decoration' => true, |
| 204 |
'dependency' => [ |
| 205 |
'admin_bar_logo_type', |
| 206 |
'==', |
| 207 |
'text_logo', |
| 208 |
'true' |
| 209 |
], |
| 210 |
'default' => $this->get_default_field( 'admin_bar_dark_mode' )['admin_bar_dark_logo_text_typo'], |
| 211 |
], |
| 212 |
[ |
| 213 |
'id' => 'admin_bar_dark_logo', |
| 214 |
'type' => 'media', |
| 215 |
'title' => __( 'Dark Logo', 'adminify' ), |
| 216 |
'library' => 'image', |
| 217 |
'preview_size' => 'thumbnail', |
| 218 |
'button_title' => __( 'Add Dark Logo', 'adminify' ), |
| 219 |
'remove_title' => __( 'Remove Dark Logo', 'adminify' ), |
| 220 |
'default' => $this->get_default_field( 'admin_bar_dark_mode' )['admin_bar_dark_logo'], |
| 221 |
'dependency' => [ |
| 222 |
'admin_bar_logo_type', |
| 223 |
'==', |
| 224 |
'image_logo', |
| 225 |
'true' |
| 226 |
], |
| 227 |
], |
| 228 |
[ |
| 229 |
'id' => 'dark_logo_size', |
| 230 |
'type' => 'dimensions', |
| 231 |
'title' => __( 'Logo Size', 'adminify' ), |
| 232 |
'default' => $this->get_default_field( 'admin_bar_dark_mode' )['dark_logo_size'], |
| 233 |
'dependency' => [ |
| 234 |
'admin_bar_logo_type', |
| 235 |
'==', |
| 236 |
'image_logo', |
| 237 |
'true' |
| 238 |
], |
| 239 |
] |
| 240 |
], |
| 241 |
'dependency' => [ |
| 242 |
'admin_ui|admin_bar_mode', |
| 243 |
'==|==', |
| 244 |
'true|dark', |
| 245 |
'true' |
| 246 |
], |
| 247 |
]; |
| 248 |
$fields[] = [ |
| 249 |
'id' => 'gutenberg_editor_logo', |
| 250 |
'type' => 'media', |
| 251 |
'title' => __( 'Gutenberg Editor Logo', 'adminify' ), |
| 252 |
'library' => 'image', |
| 253 |
'preview_size' => 'thumbnail', |
| 254 |
'button_title' => __( 'Add Gutenberg Editor Logo', 'adminify' ), |
| 255 |
'remove_title' => __( 'Remove Gutenberg Editor Logo', 'adminify' ), |
| 256 |
'default' => $this->get_default_field( 'gutenberg_editor_logo' ), |
| 257 |
]; |
| 258 |
} |
| 259 |
|
| 260 |
public function schedule_dark_mode_fields( &$fields ) |
| 261 |
{ |
| 262 |
$fields[] = [ |
| 263 |
'type' => 'subheading', |
| 264 |
'content' => __( 'Schedule Dark Mode', 'adminify' ), |
| 265 |
]; |
| 266 |
$fields[] = [ |
| 267 |
'type' => 'notice', |
| 268 |
'title' => __( 'Enable Schedule Dark Mode', 'adminify' ), |
| 269 |
'style' => 'warning', |
| 270 |
'content' => Utils::adminify_upgrade_pro(), |
| 271 |
]; |
| 272 |
} |
| 273 |
|
| 274 |
public function general_layout_mode_settings() |
| 275 |
{ |
| 276 |
if ( !class_exists( 'ADMINIFY' ) ) { |
| 277 |
return; |
| 278 |
} |
| 279 |
$fields = []; |
| 280 |
$this->layout_mode_setting_fields( $fields ); |
| 281 |
$this->schedule_dark_mode_fields( $fields ); |
| 282 |
\ADMINIFY::createSection( $this->prefix, [ |
| 283 |
'title' => __( 'Logo Options', 'adminify' ), |
| 284 |
'icon' => 'fas fa-adjust', |
| 285 |
'fields' => $fields, |
| 286 |
] ); |
| 287 |
} |
| 288 |
|
| 289 |
} |