PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
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 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / modules / components / variants / component-variant.php

component-variant.php in Elementor Website Builder – more than just a page builder 4.3.0-beta3, at modules/components/variants/component-variant.php

47 lines 925 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\Components\Variants;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 class Component_Variant {
10 /** @var string */
11 public $id;
12
13 /** @var string */
14 public $label;
15
16 /**
17 * Widget entries keyed by element id. Each entry may include:
18 * - `settings.classes.add`: string[] of class ids to add on top of the base
19 * - `variant`: string id of a nested component variant to apply
20 *
21 * @var array<string, array>
22 */
23 public $widgets;
24
25 public function __construct( string $id, string $label, array $widgets ) {
26 $this->id = $id;
27 $this->label = $label;
28 $this->widgets = $widgets;
29 }
30
31 public static function make( array $variant ): self {
32 return new self(
33 $variant['id'],
34 $variant['label'],
35 $variant['widgets'] ?? []
36 );
37 }
38
39 public function to_associative_array(): array {
40 return [
41 'id' => $this->id,
42 'label' => $this->label,
43 'widgets' => $this->widgets,
44 ];
45 }
46 }
47