| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Core\Settings\EditorPreferences; |
| 4 |
|
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Core\Settings\Base\Model as BaseModel; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; // Exit if accessed directly |
| 10 |
} |
| 11 |
|
| 12 |
class Model extends BaseModel { |
| 13 |
|
| 14 |
/** |
| 15 |
* Get element name. |
| 16 |
* |
| 17 |
* Retrieve the element name. |
| 18 |
* |
| 19 |
* @return string The name. |
| 20 |
* @since 2.8.0 |
| 21 |
* @access public |
| 22 |
* |
| 23 |
*/ |
| 24 |
public function get_name() { |
| 25 |
return 'editor-preferences'; |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Get panel page settings. |
| 30 |
* |
| 31 |
* Retrieve the page setting for the current panel. |
| 32 |
* |
| 33 |
* @since 2.8.0 |
| 34 |
* @access public |
| 35 |
*/ |
| 36 |
public function get_panel_page_settings() { |
| 37 |
return [ |
| 38 |
'title' => esc_html__( 'User Preferences', 'elementor' ), |
| 39 |
]; |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* @since 3.1.0 |
| 44 |
* @access protected |
| 45 |
*/ |
| 46 |
protected function register_controls() { |
| 47 |
$this->start_controls_section( |
| 48 |
'preferences', |
| 49 |
[ |
| 50 |
'tab' => Controls_Manager::TAB_SETTINGS, |
| 51 |
'label' => esc_html__( 'Preferences', 'elementor' ), |
| 52 |
] |
| 53 |
); |
| 54 |
|
| 55 |
$this->add_control( |
| 56 |
'ui_theme', |
| 57 |
[ |
| 58 |
'label' => esc_html__( 'UI Theme', 'elementor' ), |
| 59 |
'type' => Controls_Manager::SELECT, |
| 60 |
'description' => esc_html__( 'Set light or dark mode, or use Auto Detect to sync it with your OS setting.', 'elementor' ), |
| 61 |
'default' => 'auto', |
| 62 |
'options' => [ |
| 63 |
'auto' => esc_html__( 'Auto Detect', 'elementor' ), |
| 64 |
'light' => esc_html__( 'Light', 'elementor' ), |
| 65 |
'dark' => esc_html__( 'Dark', 'elementor' ), |
| 66 |
], |
| 67 |
] |
| 68 |
); |
| 69 |
|
| 70 |
$this->add_control( |
| 71 |
'panel_width', |
| 72 |
[ |
| 73 |
'label' => esc_html__( 'Panel Width', 'elementor' ), |
| 74 |
'type' => Controls_Manager::SLIDER, |
| 75 |
'range' => [ |
| 76 |
'px' => [ |
| 77 |
'min' => 200, |
| 78 |
'max' => 680, |
| 79 |
], |
| 80 |
], |
| 81 |
'default' => [ |
| 82 |
'size' => 300, |
| 83 |
], |
| 84 |
] |
| 85 |
); |
| 86 |
|
| 87 |
$this->add_control( |
| 88 |
'edit_buttons', |
| 89 |
[ |
| 90 |
'label' => esc_html__( 'Editing Handles', 'elementor' ), |
| 91 |
'type' => Controls_Manager::SWITCHER, |
| 92 |
'description' => esc_html__( 'Show editing handles when hovering over the element edit button.', 'elementor' ), |
| 93 |
] |
| 94 |
); |
| 95 |
|
| 96 |
$this->add_control( |
| 97 |
'lightbox_in_editor', |
| 98 |
[ |
| 99 |
'label' => esc_html__( 'Enable Lightbox In Editor', 'elementor' ), |
| 100 |
'type' => Controls_Manager::SWITCHER, |
| 101 |
'default' => 'yes', |
| 102 |
] |
| 103 |
); |
| 104 |
|
| 105 |
$this->add_control( |
| 106 |
'responsive_heading', |
| 107 |
[ |
| 108 |
'label' => __( 'Responsive Preview', 'elementor' ), |
| 109 |
'type' => Controls_Manager::HEADING, |
| 110 |
'separator' => 'before', |
| 111 |
] |
| 112 |
); |
| 113 |
|
| 114 |
$this->add_control( |
| 115 |
'show_hidden_elements', |
| 116 |
[ |
| 117 |
'label' => __( 'Hidden Elements', 'elementor' ), |
| 118 |
'type' => Controls_Manager::SWITCHER, |
| 119 |
'label_on' => 'Show', |
| 120 |
'label_off' => 'Hide', |
| 121 |
'default' => 'yes', |
| 122 |
] |
| 123 |
); |
| 124 |
|
| 125 |
$this->add_control( |
| 126 |
'default_device_view', |
| 127 |
[ |
| 128 |
'label' => esc_html__( 'Default Device View ', 'elementor' ), |
| 129 |
'type' => Controls_Manager::SELECT, |
| 130 |
'default' => 'default', |
| 131 |
'options' => [ |
| 132 |
'default' => esc_html__( 'Default', 'elementor' ), |
| 133 |
'mobile' => esc_html__( 'Mobile', 'elementor' ), |
| 134 |
'tablet' => esc_html__( 'Tablet', 'elementor' ), |
| 135 |
'desktop' => esc_html__( 'Desktop', 'elementor' ), |
| 136 |
], |
| 137 |
] |
| 138 |
); |
| 139 |
|
| 140 |
$this->end_controls_section(); |
| 141 |
} |
| 142 |
} |
| 143 |
|