PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.2
Elementor Website Builder – more than just a page builder v4.3.2
4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 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 All 456 releases
elementor / modules / atomic-widgets / elements / atomic-background-video / atomic-background-video-controls / atomic-background-video-controls.php

atomic-background-video-controls.php in Elementor Website Builder – more than just a page builder 4.3.2, at modules/atomic-widgets/elements/atomic-background-video/atomic-background-video-controls/atomic-background-video-controls.php

150 lines 4.6 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\Elements\Atomic_Background_Video\Atomic_Background_Video_Controls;
4
5 use Elementor\Modules\AtomicWidgets\Controls\Section;
6 use Elementor\Modules\AtomicWidgets\Elements\Atomic_Background_Video\Atomic_Background_Video;
7 use Elementor\Modules\AtomicWidgets\Elements\Atomic_Background_Video\Atomic_Background_Video_Pause\Atomic_Background_Video_Pause;
8 use Elementor\Modules\AtomicWidgets\Elements\Atomic_Background_Video\Atomic_Background_Video_Play\Atomic_Background_Video_Play;
9 use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Element_Base;
10 use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Element_Template;
11 use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer;
12 use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
13 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
14 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\Number_Prop_Type;
15 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
16 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
17 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
18 use Elementor\Modules\AtomicWidgets\Styles\Style_States;
19 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
20 use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type;
21
22 if ( ! defined( 'ABSPATH' ) ) {
23 exit;
24 }
25
26 class Atomic_Background_Video_Controls extends Atomic_Element_Base {
27 use Has_Element_Template;
28
29 const BASE_STYLE_KEY = 'base';
30
31 public static $widget_description = 'Controls wrapper for the Background Video element. REQUIRED children: e-background-video-play and e-background-video-pause, each with a required e-paragraph child for the button label.';
32
33 public function __construct( $data = [], $args = null ) {
34 parent::__construct( $data, $args );
35 $this->meta( 'permanently_locked', true );
36 }
37
38 public static function get_type() {
39 return 'e-background-video-controls';
40 }
41
42 public static function get_element_type(): string {
43 return 'e-background-video-controls';
44 }
45
46 public function get_title() {
47 return esc_html__( 'Controls', 'elementor' );
48 }
49
50 public function get_keywords() {
51 return [ 'ato', 'atom', 'atoms', 'atomic', 'background', 'video', 'controls' ];
52 }
53
54 public function get_icon() {
55 return 'eicon-play';
56 }
57
58 public function should_show_in_panel() {
59 return false;
60 }
61
62 public static function get_computed_html_tag( array $settings ): string {
63 return Html_Tag_Computer::compute( $settings, 'div' );
64 }
65
66 protected static function define_props_schema(): array {
67 return [
68 'classes' => Classes_Prop_Type::make()->default( [] ),
69 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
70 ];
71 }
72
73 public static function get_props_schema(): array {
74 $schema = parent::get_props_schema();
75
76 // Locked sub-element: Display Conditions belong on the Background Video root only.
77 unset( $schema['display-conditions'] );
78
79 return $schema;
80 }
81
82 protected function define_atomic_controls(): array {
83 return [
84 Section::make()
85 ->set_label( __( 'Settings', 'elementor' ) )
86 ->set_id( 'settings' )
87 ->set_items( [] ),
88 ];
89 }
90
91 protected function define_atomic_style_states(): array {
92 $class_states = Style_States::get_class_states_map();
93
94 return [
95 $class_states['playing'],
96 $class_states['paused'],
97 ];
98 }
99
100 protected function define_base_styles(): array {
101 return [
102 static::BASE_STYLE_KEY => Style_Definition::make()
103 ->add_variant(
104 Style_Variant::make()
105 ->add_props( [
106 'display' => String_Prop_Type::generate( 'flex' ),
107 'width' => Size_Prop_Type::generate( [
108 'size' => 'auto',
109 'unit' => 'custom',
110 ] ),
111 'position' => String_Prop_Type::generate( 'absolute' ),
112 'inset-block-end' => Size_Prop_Type::generate( [
113 'size' => 20,
114 'unit' => 'px',
115 ] ),
116 'inset-inline-end' => Size_Prop_Type::generate( [
117 'size' => 20,
118 'unit' => 'px',
119 ] ),
120 'z-index' => Number_Prop_Type::generate( 2 ),
121 'gap' => Size_Prop_Type::generate( [
122 'size' => 8,
123 'unit' => 'px',
124 ] ),
125 ] )
126 ),
127 ];
128 }
129
130 protected function define_default_children() {
131 return [
132 Atomic_Background_Video_Play::build_default_element( true ),
133 Atomic_Background_Video_Pause::build_default_element( true ),
134 ];
135 }
136
137 protected function define_allowed_child_types() {
138 return [
139 Atomic_Background_Video::ELEMENT_TYPE_PLAY,
140 Atomic_Background_Video::ELEMENT_TYPE_PAUSE,
141 ];
142 }
143
144 protected function get_templates(): array {
145 return [
146 'elementor/elements/atomic-background-video-controls' => __DIR__ . '/atomic-background-video-controls.html.twig',
147 ];
148 }
149 }
150