# darkify/1.4.8/src/Admin/Views/Control.php

Darkify – Dark Mode &amp; Night Mode for Website &amp; Admin (Dark Theme Included), version 1.4.8. 257 lines.

- Page: https://pluginprobe.com/plugins/darkify/1.4.8/code/src/Admin/Views/Control.php
- Raw: https://pluginprobe.com/plugins/darkify/1.4.8/raw/src/Admin/Views/Control.php
- Modified: 2025-08-30T14:29:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/darkify/1.4.8/code/src/Admin/Views/Control.php#L10-L20`.

```php
<?php

/**
 * Views class for Shortcode generator options.
 *
 * @link       https://themeatelier.net
 * @since      1.0.0
 *
 * @package darkify
 * @subpackage darkify/src/Admin/Views/Control
 * @author     ThemeAtelier<themeatelierbd@gmail.com>
 */

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' => 'section_tab',
                        'tabs' => array(

                            array(
                                'title' => esc_html__('Frontend', 'darkify'),
                                'icon'  => 'icofont-computer',
                                'fields' => array(
                                    array(
                                        'type'    => 'heading',
                                        'content' => esc_html__('Basic Control', 'darkify'),
                                    ),
                                    array(
                                        'id'      => 'enable_dark_mode_switch',
                                        'type'    => 'switcher',
                                        'title'   => esc_html__('Frontend Dark Mode', 'darkify'),
                                        'title_help' => '<div class="darkify-info-label">' . __('Show the dark mode floating switch in your Website\'s frontend.', 'darkify') . '</div><a class="tooltip_btn_primary" href="https://darkifywp.com/controls/" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="https://docs.themeatelier.net/docs/darkify-pro/darkify-settings/control/" target="_blank">' . __('Open Docs', 'darkify') . '</a>',
                                        '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' => '<div class="darkify-info-label">' . __('Automatically turn your website dark by default.', 'darkify') . '</div>',
                                        'text_on'    => esc_html__('Enabled', 'darkify'),
                                        'text_off'    => esc_html__('Disabled', 'darkify'),
                                        'text_width' => 100,
                                        // 'title_video' => '<div class="darkify-img-tag">
                                        //     <video autoplay loop muted playsinline>
                                        //         <source src="https://plugins.svn.wordpress.org/darkify/assets/video/os-aware-darkmode.webm" type="video/webm">
                                        //     </video>
                                        // </div><div class="darkify-info-label">Auto Convert Dropdowns to Button</div>',
                                    ),
                                    array(
                                        'id'      => 'enable_os_aware',
                                        'type'    => 'switcher',
                                        'title'   => esc_html__('OS Aware Dark Mode', 'darkify'),
                                        'title_video' => '<div class="darkify-img-tag">
                                            <video autoplay loop muted playsinline>
                                                <source src="https://plugins.svn.wordpress.org/darkify/assets/videos/os-aware-darkmode.webm" type="video/webm">
                                            </video>
                                        </div><div class="darkify-info-label">Dark Mode toggling based on OS setting</div>',
                                        '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' => '<div class="darkify-info-label">' . __('Enable to dark mode by pressing Ctrl+Alt+D on windows keyboard & Ctrl+Opt|Start+D on mac.', 'darkify') . '</div>',
                                        'text_on'    => esc_html__('Enabled', 'darkify'),
                                        'text_off'    => esc_html__('Disabled', 'darkify'),
                                        'text_width' => 100,
                                        'default' => true,
                                    ),
                                    array(
                                        'type' => 'heading',
                                        'title' => esc_html__('Advanced Control', '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' => '<div class="darkify-info-label">' . __('Automatically turn dark mode ON based on users’ localtime.', 'darkify') . '</div>',
                                                'text_on'    => esc_html__('Enabled', 'darkify'),
                                                'text_off'    => esc_html__('Disabled', 'darkify'),
                                                'text_width' => 100,
                                            ),
                                            array(
                                                'id'        => 'time_based_dark_start',
                                                'type'      => 'datetime',
                                                'title'     => esc_html__('Pick a Time', 'darkify'),
                                                'title_help' => '<div class="darkify-info-label">' . __('Set the exact start and end times when dark mode should automatically be enabled or disabled.', 'darkify') . '</div>',
                                                'from_to'   => true,
                                                'text_from' => esc_html__('Form', 'darkify'),
                                                'text_to'   => esc_html__('To', 'darkify'),
                                                'settings'  => array(
                                                    'noCalendar' => true,
                                                    'enableTime' => true,
                                                    'dateFormat' => 'H:i',
                                                    'time_24hr'  => false,
                                                ),
                                                'dependency' => array('enable_time_based_dark', '==', 'true'),
                                            ),
                                        ),
                                    ),
                                    array(
                                        'id'      => 'hide_on_desktop',
                                        'type'    => 'switcher',
                                        'title'   => esc_html__('Hide Dark Mode Switch On Desktop', 'darkify'),
                                        'title_help' => '<div class="darkify-info-label">' . __('Hide the Dark Mode Floating Switch if users’ are using desktop or laptop.', 'darkify') . '</div>',
                                        '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' => '<div class="darkify-info-label">' . __('Hide the Dark Mode Floating Switch if user(s) are using mobile.', 'darkify') . '</div>',
                                                '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 By', 'darkify'),
                                                'title_help' => '<div class="darkify-info-label">' . __('Choose the method to detect mobile devices: by User Agent, by Screen Size, or use Both for maximum accuracy.', 'darkify') . '</div>',
                                                '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' => '<div class="darkify-info-label">' . __('Show the dark mode toggle switch in specific menu.', 'darkify') . '</div>',
                                                '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' => '<div class="darkify-info-label">' . __('Configure menu switch options and placement for your site.', 'darkify') . '</div><a class="tooltip_btn_primary" href="https://darkifywp.com/controls#menu-switcher" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="https://docs.themeatelier.net/docs/darkify-pro/darkify-settings/controls/" target="_blank">' . __('Open Docs', 'darkify') . '</a>',
                                                'accordion_title_number' => true,
                                                'accordion_title_auto' => true,
                                                'class' => 'select_menus',
                                                'max' => '1',
                                                'add_more_text' => __('Want to use switch in unlimited number of menus? <a target="_blank" href="https://darkifywp.com/pricing/?ref=1"><b>Upgrade To Pro!</b></a>', 'darkify'),
                                                'fields' => array(
                                                    array(
                                                        'id'          => 'switch_in_menu_location',
                                                        'type'        => 'select',
                                                        'class' =>    'select_menu_location',
                                                        'title'       => esc_html__('Select Menu', 'darkify'),
                                                        'title_help'       => '<div class="darkify-info-label">' . esc_html__('Choose an option from the dropdown menu', 'darkify') . '</div>',
                                                        'options'     => 'menus',
                                                        'empty_message' => esc_html__('You haven\'t created a menu yet. If you\'re using an FSE theme, copy the shortcode below and paste it where you want the switch to appear.', 'darkify'),
                                                    ),
                                                    array(
                                                        'id'          => 'darkify_menu_shortcode_helper',
                                                        'type'        => 'textarea',
                                                        'title'       => esc_html__('Shortcode To Add On Menu', 'darkify'),
                                                        'title_help' => '<div class="darkify-info-label">' . __('You can change shortcode options value based on your pereference.', 'darkify') . '</div>',
                                                        'default'     => '[darkify switch="1" width="60px" height="60px" icon_size="40px" 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"]'
                                                    ),
                                                    array(
                                                        'id'          => 'select_menu_position',
                                                        'type'        => 'button_set',
                                                        'title'       => esc_html__('Select Menu Position', 'darkify'),
                                                        'title_help'       => '<div class="darkify-info-label">' . esc_html__('Choose the position for the select menu', 'darkify') . '</div>',
                                                        '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' => '<div class="darkify-info-label">' . __('Switch to enable Dark Mode in WordPress Admin Panel.', 'darkify') . '</div><a class="tooltip_btn_primary" href="https://darkifywp.com/controls/" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="https://docs.themeatelier.net/docs/darkify-pro/darkify-settings/controls/#admin_controls" target="_blank">' . __('Open Docs', 'darkify') . '</a>',
                                        'default' => false,
                                        'text_on'    => esc_html__('Enabled', 'darkify'),
                                        'text_off'    => esc_html__('Disabled', 'darkify'),
                                        'text_width' => 100,
                                    ),

                                    array(
                                        'id'          => 'disallowed_admin_pages',
                                        'type'        => 'textarea',
                                        'title'       => esc_html__('Disallowed Pages', 'darkify'),
                                        'title_help'        =>  '<div class="darkify-info-label">' . __('If the admin page URL is like http://example.com/wp-admin/admin.php?page=darkify then darkify is it\'s page slug.', 'darkify') . '</div>',
                                        'placeholder' => esc_html__('Enter comma separated page slugs. Example: darkify-dashboard, elementor', 'darkify'),
                                        'dependency'  => array('enable_admin_panel_dark_mode', '==', 'true'),
                                        'class' => 'only_pro'
                                    ),

                                ),
                            ),
                        ),
                    ),
                ),
            ),
        );
    }
}

```
