← All changes
|
modules/atomic-widgets/elements/base/element-builder.php
+10
-0
4.1.0-beta1
→
4.2.4
View file →
| @@ -7,8 +7,9 @@ | ||
| 7 | 7 | protected $settings = []; |
| 8 | 8 | protected $is_locked = false; |
| 9 | 9 | protected $children = []; |
| 10 | 10 | protected $editor_settings = []; |
| 11 | + protected $meta = []; | |
| 11 | 12 | |
| 12 | 13 | public static function make( string $element_type ) { |
| 13 | 14 | return new self( $element_type ); |
| 14 | 15 | } |
| @@ -36,8 +37,13 @@ | ||
| 36 | 37 | $this->children = $children; |
| 37 | 38 | return $this; |
| 38 | 39 | } |
| 39 | 40 | |
| 41 | + public function meta( array $meta ) { | |
| 42 | + $this->meta = $meta; | |
| 43 | + return $this; | |
| 44 | + } | |
| 45 | + | |
| 40 | 46 | public function build() { |
| 41 | 47 | $element_data = [ |
| 42 | 48 | 'elType' => $this->element_type, |
| 43 | 49 | 'settings' => $this->settings, |
| @@ -44,8 +50,12 @@ | ||
| 44 | 50 | 'isLocked' => $this->is_locked, |
| 45 | 51 | 'editor_settings' => $this->editor_settings, |
| 46 | 52 | 'elements' => $this->children, |
| 47 | 53 | ]; |
| 54 | + | |
| 55 | + if ( ! empty( $this->meta ) ) { | |
| 56 | + $element_data['meta'] = $this->meta; | |
| 57 | + } | |
| 48 | 58 | |
| 49 | 59 | return $element_data; |
| 50 | 60 | } |
| 51 | 61 | } |