| @@ -2,14 +2,15 @@ | ||
| 2 | 2 | namespace Elementor\Core\Kits\Documents; |
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\DocumentTypes\PageBase; |
| 5 | 5 | use Elementor\Core\Files\CSS\Post as Post_CSS; |
| 6 | +use Elementor\Core\Kits\Documents\Tabs; | |
| 6 | 7 | use Elementor\Core\Settings\Manager as SettingsManager; |
| 7 | 8 | use Elementor\Core\Settings\Page\Manager as PageManager; |
| 8 | 9 | use Elementor\Plugin; |
| 9 | 10 | |
| 10 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | - exit; // Exit if accessed directly. | |
| 12 | + exit; // Exit if accessed directly | |
| 12 | 13 | } |
| 13 | 14 | |
| 14 | 15 | class Kit extends PageBase { |
| 15 | 16 | /** |
| @@ -110,12 +111,12 @@ | ||
| 110 | 111 | /** |
| 111 | 112 | * Register a kit settings menu. |
| 112 | 113 | * |
| 113 | 114 | * @param $id |
| 114 | - * @param $class_name | |
| 115 | + * @param $class | |
| 115 | 116 | */ |
| 116 | - public function register_tab( $id, $class_name ) { | |
| 117 | - $this->tabs[ $id ] = new $class_name( $this ); | |
| 117 | + public function register_tab( $id, $class ) { | |
| 118 | + $this->tabs[ $id ] = new $class( $this ); | |
| 118 | 119 | } |
| 119 | 120 | |
| 120 | 121 | /** |
| 121 | 122 | * @inheritDoc |
| @@ -124,9 +125,8 @@ | ||
| 124 | 125 | $config = parent::get_initial_config(); |
| 125 | 126 | |
| 126 | 127 | foreach ( $this->tabs as $id => $tab ) { |
| 127 | 128 | $config['tabs'][ $id ] = [ |
| 128 | - 'id' => $id, | |
| 129 | 129 | 'title' => $tab->get_title(), |
| 130 | 130 | 'icon' => $tab->get_icon(), |
| 131 | 131 | 'group' => $tab->get_group(), |
| 132 | 132 | 'helpUrl' => $tab->get_help_url(), |
| @@ -141,13 +141,27 @@ | ||
| 141 | 141 | * @since 3.1.0 |
| 142 | 142 | * @access protected |
| 143 | 143 | */ |
| 144 | 144 | protected function register_controls() { |
| 145 | + $is_edit_mode = Plugin::$instance->editor->is_edit_mode(); | |
| 146 | + | |
| 147 | + if ( ! $is_edit_mode ) { | |
| 148 | + // In the Front End, the Kit is initialized before CSS is generated, so we always duplicate controls in | |
| 149 | + // the kit. | |
| 150 | + $initial_responsive_controls_duplication_mode = Plugin::$instance->breakpoints->get_responsive_control_duplication_mode(); | |
| 151 | + | |
| 152 | + Plugin::$instance->breakpoints->set_responsive_control_duplication_mode( 'on' ); | |
| 153 | + } | |
| 154 | + | |
| 145 | 155 | $this->register_document_controls(); |
| 146 | 156 | |
| 147 | 157 | foreach ( $this->tabs as $tab ) { |
| 148 | 158 | $tab->register_controls(); |
| 149 | 159 | } |
| 160 | + | |
| 161 | + if ( ! $is_edit_mode ) { | |
| 162 | + Plugin::$instance->breakpoints->set_responsive_control_duplication_mode( $initial_responsive_controls_duplication_mode ); | |
| 163 | + } | |
| 150 | 164 | } |
| 151 | 165 | |
| 152 | 166 | protected function get_post_statuses() { |
| 153 | 167 | return [ |
| @@ -172,9 +186,9 @@ | ||
| 172 | 186 | |
| 173 | 187 | $page_settings_manager = SettingsManager::get_settings_managers( 'page' ); |
| 174 | 188 | $page_settings_manager->save_settings( $document_settings, $this->get_id() ); |
| 175 | 189 | |
| 176 | - /** @var Kit $autosave */ | |
| 190 | + /** @var Kit $autosave **/ | |
| 177 | 191 | $autosave = $this->get_autosave(); |
| 178 | 192 | |
| 179 | 193 | if ( $autosave ) { |
| 180 | 194 | $autosave->add_repeater_row( $control_id, $item ); |