| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\AtomicWidgets\Styles; |
| 4 |
|
| 5 |
class Style_Definition { |
| 6 |
private string $type = 'class'; |
| 7 |
private string $label = ''; |
| 8 |
|
| 9 |
/** @var Style_Variant[] */ |
| 10 |
private array $variants = []; |
| 11 |
|
| 12 |
public static function make(): self { |
| 13 |
return new self(); |
| 14 |
} |
| 15 |
|
| 16 |
public function set_type( string $type ): self { |
| 17 |
$this->type = $type; |
| 18 |
|
| 19 |
return $this; |
| 20 |
} |
| 21 |
|
| 22 |
public function set_label( string $label ): self { |
| 23 |
$this->label = $label; |
| 24 |
|
| 25 |
return $this; |
| 26 |
} |
| 27 |
|
| 28 |
public function add_variant( Style_Variant $variant ): self { |
| 29 |
$this->variants[] = $variant->build(); |
| 30 |
|
| 31 |
return $this; |
| 32 |
} |
| 33 |
|
| 34 |
public function build( string $id ): array { |
| 35 |
return [ |
| 36 |
'id' => $id, |
| 37 |
'type' => $this->type, |
| 38 |
'label' => $this->label, |
| 39 |
'variants' => $this->variants, |
| 40 |
]; |
| 41 |
} |
| 42 |
} |
| 43 |
|