*/
namespace ThemeAtelier\Darkify\Admin\Views;
use ThemeAtelier\Darkify\Admin\Framework\Classes\Darkify;
class Control
{
/**
* Create Option fields for the setting options.
*
* @param string $prefix Option setting key prefix.
* @return void
*/
public static function options($prefix)
{
Darkify::createSection(
$prefix,
array(
'title' => esc_html__('CONTROLS', 'darkify'),
'icon' => 'icofont-ui-settings',
'fields' => array(
array(
'type' => 'notice',
'content' => __('
Things Not Working as Expected?
Every theme and page layout is built differently. If a section doesn’t turn dark, it’s usually using a background image, inline style, or custom CSS. Use Darkify’s control settings (color overrides, image filters, exclusions, or custom CSS) to fine-tune the result. If you still need help, create a support topic anytime—we’re happy to assist.', 'darkify'),
),
array(
'type' => 'section_tab',
'tabs' => array(
array(
'title' => esc_html__('Frontend', 'darkify'),
'icon' => 'icofont-computer',
'fields' => array(
array(
'type' => 'heading',
'content' => esc_html__('Basic Controls', 'darkify'),
),
array(
'id' => 'enable_dark_mode_switch',
'type' => 'switcher',
'title' => esc_html__('Frontend Dark Mode', 'darkify'),
'title_help' => '' .
__('Show the dark mode floating switch on your website frontend.', 'darkify') .
'
' . '' .
esc_html__('Live Demo', 'darkify') . '' . '' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Enabled', 'darkify'),
'text_off' => esc_html__('Disabled', 'darkify'),
'text_width' => 100,
'default' => true,
),
array(
'id' => 'enable_default_dark_mode',
'type' => 'switcher',
'title' => esc_html__('Default Dark Mode', 'darkify'),
'title_help' =>
'' .
__('Enable dark mode by default on your website.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Enabled', 'darkify'),
'text_off' => esc_html__('Disabled', 'darkify'),
'text_width' => 100,
),
array(
'id' => 'enable_os_aware',
'type' => 'switcher',
'title' => esc_html__('OS Aware Dark Mode', 'darkify'),
'title_help' =>
'' .
__('Toggle dark mode based on the user’s device or operating system preference.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Enabled', 'darkify'),
'text_off' => esc_html__('Disabled', 'darkify'),
'text_width' => 100,
'default' => true,
),
array(
'id' => 'enable_keyboard_shortcut',
'type' => 'switcher',
'title' => esc_html__('Keyboard Shortcut', 'darkify'),
'title_help' =>
'' .
__('Toggle dark mode using a keyboard shortcut. Use Ctrl + Alt + D on Windows, and Control + Option + D on macOS.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Enabled', 'darkify'),
'text_off' => esc_html__('Disabled', 'darkify'),
'text_width' => 100,
'default' => true,
),
array(
'type' => 'heading',
'title' => esc_html__('Advanced Controls', 'darkify'),
),
// Enable Time Based Auto Dark Mode
array(
'id' => 'enable_time',
'type' => 'fieldset',
'fields' => array(
array(
'id' => 'enable_time_based_dark',
'type' => 'switcher',
'title' => esc_html__('Time Based Auto Dark Mode', 'darkify'),
'title_help' =>
'' .
__('Automatically enable dark mode based on the user’s local time.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Enabled', 'darkify'),
'text_off' => esc_html__('Disabled', 'darkify'),
'text_width' => 100,
),
array(
'id' => 'enable_time_fields',
'type' => 'fieldset',
'class' => 'enable_time_fields',
'dependency' => array('enable_time_based_dark', '==', 'true'),
'title' => esc_html__('Pick a Time', 'darkify'),
'title_help' =>
'' .
__('Set the exact start and end times when dark mode should be automatically enabled or disabled.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'fields' => array(
array(
'id' => 'time_based_dark_start',
'type' => 'datetime',
'after' => esc_html__('From', 'darkify'),
'placeholder' => esc_html__('From', 'darkify'),
'settings' => array(
'noCalendar' => true,
'enableTime' => true,
'dateFormat' => 'H:i',
'time_24hr' => false,
),
),
array(
'id' => 'time_based_dark_end',
'type' => 'datetime',
'after' => esc_html__('To', 'darkify'),
'placeholder' => esc_html__('To', 'darkify'),
'settings' => array(
'noCalendar' => true,
'enableTime' => true,
'dateFormat' => 'H:i',
'time_24hr' => false,
),
),
),
),
),
),
array(
'id' => 'hide_on_desktop',
'type' => 'switcher',
'title' => esc_html__('Hide Dark Mode Switch on Desktop', 'darkify'),
'title_help' =>
'' .
__('Hide the dark mode floating switch when users are browsing on a desktop or laptop.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Yes', 'darkify'),
'text_off' => esc_html__('No', 'darkify'),
),
array(
'id' => 'hide_on_mobile',
'type' => 'fieldset',
'fields' => array(
array(
'id' => 'hide_dark_mode_on_mobile',
'type' => 'switcher',
'title' => esc_html__('Hide Dark Mode on Mobile', 'darkify'),
'title_help' =>
'' .
__('Hide the dark mode floating switch when users are browsing on mobile devices.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Yes', 'darkify'),
'text_off' => esc_html__('No', 'darkify'),
),
array(
'id' => 'type_of_hide_by',
'type' => 'button_set',
'title' => esc_html__('Hide Detection Method', 'darkify'),
'title_help' =>
'' .
__('Choose how mobile devices are detected: by User Agent, by Screen Size, or use Both for maximum accuracy.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'options' => array(
'user_agent' => esc_html__('User Agent', 'darkify'),
'screen_size' => esc_html__('Screen Size', 'darkify'),
'both' => esc_html__('Both', 'darkify'),
),
'default' => 'both',
'dependency' => array('hide_dark_mode_on_mobile', '==', 'true'),
),
),
),
array(
'id' => 'show_in_menu',
'type' => 'fieldset',
'fields' => array(
array(
'id' => 'enable_switch_in_menu',
'type' => 'switcher',
'title' => esc_html__('Show Switch in Menu', 'darkify'),
'title_help' =>
'' .
__('Show the dark mode toggle switch in a selected menu.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Yes', 'darkify'),
'text_off' => esc_html__('No', 'darkify'),
),
array(
'id' => 'select_menus',
'type' => 'group',
'title' => esc_html__('Menu Switch Settings', 'darkify'),
'title_help' =>
'' .
__('Configure menu switch options and placement for your site.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'add_more_text' => sprintf(
/* translators: %s: URL to the Darkify Pro pricing page. */
__(
'Want to use the switch in an unlimited number of menus? Upgrade to Pro.',
'darkify'
),
esc_url(DARKIFY_DEMO_URL . 'pricing/?ref=1')
),
'accordion_title_number' => true,
'accordion_title_auto' => true,
'class' => 'select_menus',
'max' => 1,
'fields' => array(
array(
'id' => 'switch_in_menu_location',
'type' => 'select',
'class' => 'select_menu_location',
'title' => esc_html__('Select Menu', 'darkify'),
'title_help' =>
'' .
esc_html__('Choose a menu from the dropdown list.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'empty_message' => esc_html__(
'You have not created a menu yet. If you are using a Full Site Editing (FSE) theme, copy the shortcode below and paste it where you want the switch to appear.',
'darkify'
),
'options' => 'menus',
),
array(
'id' => 'darkify_menu_shortcode_helper',
'type' => 'textarea',
'title' => esc_html__('Shortcode for Menu', 'darkify'),
'title_help' =>
'' .
__('You can customize the shortcode options based on your preference.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'default' => '[darkify switch="1" light_mode_bg="#121116" dark_mode_bg="#ffffff" light_mode_color="#ffffff" dark_mode_color="#121116" border="0px" border_light_color="#121119" border_dark_color="#ffffff" border_radius="7px" switch_size="100"]'
),
array(
'id' => 'select_menu_position',
'type' => 'button_set',
'title' => esc_html__('Select Menu Position', 'darkify'),
'title_help' =>
'' .
esc_html__('Choose where the dark mode switch should appear in the menu.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'options' => array(
'after' => esc_html__('After', 'darkify'),
'before' => esc_html__('Before', 'darkify'),
),
'default' => 'after',
),
),
'dependency' => array('enable_switch_in_menu', '==', 'true'),
),
),
),
),
),
array(
'title' => esc_html__('Admin', 'darkify'),
'icon' => 'icofont-dashboard-web',
'fields' => array(
array(
'id' => 'enable_admin_panel_dark_mode',
'type' => 'switcher',
'title' => esc_html__('Admin Panel Dark Mode', 'darkify'),
'title_help' =>
'' .
__('Enable dark mode in the WordPress admin dashboard.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Enabled', 'darkify'),
'text_off' => esc_html__('Disabled', 'darkify'),
'default' => false,
'text_width' => 100,
),
array(
'id' => 'block_editor_dark_mode',
'type' => 'switcher',
'title' => esc_html__('Block Editor Dark Mode', 'darkify'),
'title_help' =>
'' .
__('Enable the dark mode switch in the block editor to toggle between dark and light mode.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Enabled', 'darkify'),
'text_off' => esc_html__('Disabled', 'darkify'),
'default' => true,
'text_width' => 100,
'dependency' => array('enable_admin_panel_dark_mode', '==', 'true'),
),
array(
'id' => 'classic_editor_dark_mode',
'type' => 'switcher',
'title' => esc_html__('Classic Editor Dark Mode', 'darkify'),
'title_help' =>
'' .
__('Enable the dark mode switch in the classic editor to toggle between dark and light modes.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'text_on' => esc_html__('Enabled', 'darkify'),
'text_off' => esc_html__('Disabled', 'darkify'),
'default' => true,
'text_width' => 100,
'dependency' => array('enable_admin_panel_dark_mode', '==', 'true'),
),
array(
'id' => 'disallowed_admin_pages',
'type' => 'textarea',
'title' => esc_html__('Disallowed Pages', 'darkify'),
'title_help' => '' .
__('If an admin page URL looks like http://example.com/wp-admin/admin.php?page=darkify, then "darkify" is the page slug.', 'darkify') .
'
' .
'' .
esc_html__('Live Demo', 'darkify') .
'' .
'' .
esc_html__('Open Docs', 'darkify') .
'',
'placeholder' => esc_html__('Enter comma-separated page slugs. Example: darkify-dashboard, elementor', 'darkify'),
'dependency' => array('enable_admin_panel_dark_mode', '==', 'true'),
'class' => 'only_pro'
),
),
),
),
),
),
),
);
}
}