| @@ -3,9 +3,8 @@ | ||
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\Base\Module; |
| 5 | 5 | use Elementor\Core\Kits\Documents\Tabs\Settings_Layout; |
| 6 | 6 | use Elementor\Core\Responsive\Files\Frontend; |
| 7 | -use Elementor\Modules\DevTools\Deprecation; | |
| 8 | 7 | use Elementor\Plugin; |
| 9 | 8 | |
| 10 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | 10 | exit; // Exit if accessed directly. |
| @@ -67,20 +66,8 @@ | ||
| 67 | 66 | private $responsive_control_duplication_mode = 'off'; |
| 68 | 67 | |
| 69 | 68 | private $icons_map; |
| 70 | 69 | |
| 71 | - /** | |
| 72 | - * Has Custom Breakpoints | |
| 73 | - * | |
| 74 | - * A flag that holds a cached value that indicates if there are active custom-breakpoints. | |
| 75 | - * | |
| 76 | - * @since 3.5.0 | |
| 77 | - * @access private | |
| 78 | - * | |
| 79 | - * @var boolean | |
| 80 | - */ | |
| 81 | - private $has_custom_breakpoints; | |
| 82 | - | |
| 83 | 70 | public function get_name() { |
| 84 | 71 | return 'breakpoints'; |
| 85 | 72 | } |
| 86 | 73 | |
| @@ -133,9 +120,8 @@ | ||
| 133 | 120 | public function get_active_devices_list( $args = [] ) { |
| 134 | 121 | $default_args = [ |
| 135 | 122 | 'add_desktop' => true, |
| 136 | 123 | 'reverse' => false, |
| 137 | - 'desktop_first' => false, | |
| 138 | 124 | ]; |
| 139 | 125 | |
| 140 | 126 | $args = array_merge( $default_args, $args ); |
| 141 | 127 | |
| @@ -142,9 +128,9 @@ | ||
| 142 | 128 | $active_devices = array_keys( Plugin::$instance->breakpoints->get_active_breakpoints() ); |
| 143 | 129 | |
| 144 | 130 | if ( $args['add_desktop'] ) { |
| 145 | 131 | // Insert the 'desktop' device in the correct position. |
| 146 | - if ( ! $args['desktop_first'] && in_array( 'widescreen', $active_devices, true ) ) { | |
| 132 | + if ( in_array( 'widescreen', $active_devices, true ) ) { | |
| 147 | 133 | $widescreen_index = array_search( 'widescreen', $active_devices, true ); |
| 148 | 134 | |
| 149 | 135 | array_splice( $active_devices, $widescreen_index, 0, [ 'desktop' ] ); |
| 150 | 136 | } else { |
| @@ -170,12 +156,8 @@ | ||
| 170 | 156 | * |
| 171 | 157 | * @return boolean |
| 172 | 158 | */ |
| 173 | 159 | public function has_custom_breakpoints() { |
| 174 | - if ( isset( $this->has_custom_breakpoints ) ) { | |
| 175 | - return $this->has_custom_breakpoints; | |
| 176 | - } | |
| 177 | - | |
| 178 | 160 | $breakpoints = $this->get_active_breakpoints(); |
| 179 | 161 | |
| 180 | 162 | $additional_breakpoints = [ |
| 181 | 163 | self::BREAKPOINT_KEY_MOBILE_EXTRA, |
| @@ -185,23 +167,17 @@ | ||
| 185 | 167 | ]; |
| 186 | 168 | |
| 187 | 169 | foreach ( $breakpoints as $breakpoint_name => $breakpoint ) { |
| 188 | 170 | if ( in_array( $breakpoint_name, $additional_breakpoints, true ) ) { |
| 189 | - $this->has_custom_breakpoints = true; | |
| 190 | - | |
| 191 | 171 | return true; |
| 192 | 172 | } |
| 193 | 173 | |
| 194 | 174 | /** @var Breakpoint $breakpoint */ |
| 195 | 175 | if ( $breakpoint->is_custom() ) { |
| 196 | - $this->has_custom_breakpoints = true; | |
| 197 | - | |
| 198 | 176 | return true; |
| 199 | 177 | } |
| 200 | 178 | } |
| 201 | 179 | |
| 202 | - $this->has_custom_breakpoints = false; | |
| 203 | - | |
| 204 | 180 | return false; |
| 205 | 181 | } |
| 206 | 182 | |
| 207 | 183 | /** |
| @@ -264,10 +240,8 @@ | ||
| 264 | 240 | return $active_breakpoints[ $desktop_previous_device ]->get_value() + 1; |
| 265 | 241 | } |
| 266 | 242 | |
| 267 | 243 | public function refresh() { |
| 268 | - unset( $this->has_custom_breakpoints ); | |
| 269 | - | |
| 270 | 244 | $this->init_breakpoints(); |
| 271 | 245 | $this->init_active_breakpoints(); |
| 272 | 246 | } |
| 273 | 247 | |
| @@ -310,24 +284,24 @@ | ||
| 310 | 284 | */ |
| 311 | 285 | public static function get_default_config() { |
| 312 | 286 | return [ |
| 313 | 287 | self::BREAKPOINT_KEY_MOBILE => [ |
| 314 | - 'label' => esc_html__( 'Mobile Portrait', 'elementor' ), | |
| 288 | + 'label' => esc_html__( 'Mobile', 'elementor' ), | |
| 315 | 289 | 'default_value' => 767, |
| 316 | 290 | 'direction' => 'max', |
| 317 | 291 | ], |
| 318 | 292 | self::BREAKPOINT_KEY_MOBILE_EXTRA => [ |
| 319 | - 'label' => esc_html__( 'Mobile Landscape', 'elementor' ), | |
| 293 | + 'label' => esc_html__( 'Mobile Extra', 'elementor' ), | |
| 320 | 294 | 'default_value' => 880, |
| 321 | 295 | 'direction' => 'max', |
| 322 | 296 | ], |
| 323 | 297 | self::BREAKPOINT_KEY_TABLET => [ |
| 324 | - 'label' => esc_html__( 'Tablet Portrait', 'elementor' ), | |
| 298 | + 'label' => esc_html__( 'Tablet', 'elementor' ), | |
| 325 | 299 | 'default_value' => 1024, |
| 326 | 300 | 'direction' => 'max', |
| 327 | 301 | ], |
| 328 | 302 | self::BREAKPOINT_KEY_TABLET_EXTRA => [ |
| 329 | - 'label' => esc_html__( 'Tablet Landscape', 'elementor' ), | |
| 303 | + 'label' => esc_html__( 'Tablet Extra', 'elementor' ), | |
| 330 | 304 | 'default_value' => 1200, |
| 331 | 305 | 'direction' => 'max', |
| 332 | 306 | ], |
| 333 | 307 | self::BREAKPOINT_KEY_LAPTOP => [ |
| @@ -523,15 +497,12 @@ | ||
| 523 | 497 | |
| 524 | 498 | $deprecated_hook = 'elementor/core/responsive/get_stylesheet_templates'; |
| 525 | 499 | $replacement_hook = 'elementor/core/breakpoints/get_stylesheet_template'; |
| 526 | 500 | |
| 527 | - /** | |
| 528 | - * @type Deprecation $deprecation_module | |
| 529 | - */ | |
| 530 | - $deprecation_module = Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation; | |
| 501 | + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_hook( $deprecated_hook, '3.2.0', $replacement_hook ); | |
| 531 | 502 | |
| 532 | 503 | // TODO: REMOVE THIS DEPRECATED HOOK IN ELEMENTOR v3.10.0/v4.0.0 |
| 533 | - $templates = $deprecation_module->apply_deprecated_filter( $deprecated_hook, [ $templates ], '3.2.0', $replacement_hook ); | |
| 504 | + $templates = apply_filters( $deprecated_hook, $templates ); | |
| 534 | 505 | |
| 535 | 506 | return apply_filters( $replacement_hook, $templates ); |
| 536 | 507 | } |
| 537 | 508 | } |