PluginProbe
Elementor Website Builder – more than just a page builder / 3.34.2
Elementor Website Builder – more than just a page builder v3.34.2
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / atomic-widgets / styles / style-states.php

style-states.php in Elementor Website Builder – more than just a page builder 3.34.2, at modules/atomic-widgets/styles/style-states.php

59 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\AtomicWidgets\Styles;
4
5 class Style_States {
6 const HOVER = 'hover';
7 const ACTIVE = 'active';
8 const FOCUS = 'focus';
9
10 const SELECTED = 'e--selected';
11
12 public static function get_pseudo_states(): array {
13 return [
14 self::HOVER,
15 self::ACTIVE,
16 self::FOCUS,
17 ];
18 }
19
20 public static function get_class_states(): array {
21 return [
22 self::SELECTED,
23 ];
24 }
25
26 public static function get_valid_states(): array {
27 return [
28 ...self::get_pseudo_states(),
29 ...self::get_class_states(),
30 null,
31 ];
32 }
33
34 public static function is_pseudo_state( string $state ): bool {
35 return in_array( $state, self::get_pseudo_states(), true );
36 }
37
38 public static function is_class_state( string $state ): bool {
39 return in_array( $state, self::get_class_states(), true );
40 }
41
42 public static function is_valid_state( $state ): bool {
43 if ( null === $state ) {
44 return true;
45 }
46
47 return is_string( $state ) && in_array( $state, self::get_valid_states(), true );
48 }
49
50 public static function get_class_states_map(): array {
51 return [
52 'selected' => [
53 'name' => 'selected',
54 'value' => self::SELECTED,
55 ],
56 ];
57 }
58 }
59