| 1 |
<?php |
| 2 |
namespace Elementor\Modules\AtomicWidgets\Controls; |
| 3 |
|
| 4 |
use JsonSerializable; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; // Exit if accessed directly |
| 8 |
} |
| 9 |
|
| 10 |
class Section implements JsonSerializable { |
| 11 |
private $label = null; |
| 12 |
private $description = null; |
| 13 |
private array $items = []; |
| 14 |
|
| 15 |
public static function make(): self { |
| 16 |
return new static(); |
| 17 |
} |
| 18 |
|
| 19 |
public function set_label( string $label ): self { |
| 20 |
$this->label = $label; |
| 21 |
|
| 22 |
return $this; |
| 23 |
} |
| 24 |
|
| 25 |
public function set_description( string $description ): self { |
| 26 |
$this->description = $description; |
| 27 |
|
| 28 |
return $this; |
| 29 |
} |
| 30 |
|
| 31 |
public function set_items( array $items ): self { |
| 32 |
$this->items = $items; |
| 33 |
|
| 34 |
return $this; |
| 35 |
} |
| 36 |
|
| 37 |
public function get_items() { |
| 38 |
return $this->items; |
| 39 |
} |
| 40 |
|
| 41 |
public function jsonSerialize(): array { |
| 42 |
return [ |
| 43 |
'type' => 'section', |
| 44 |
'value' => [ |
| 45 |
'label' => $this->label, |
| 46 |
'description' => $this->description, |
| 47 |
'items' => $this->items, |
| 48 |
], |
| 49 |
]; |
| 50 |
} |
| 51 |
} |
| 52 |
|