← All changes
|
modules/components/documents/component-overridable-prop.php
+2
-38
4.2.3
→
3.34.1
View file →
| @@ -24,16 +24,13 @@ | ||
| 24 | 24 | /** @var string */ |
| 25 | 25 | public $label; |
| 26 | 26 | |
| 27 | 27 | /** @var array{ $$type: string, value: mixed } */ |
| 28 | - public $origin_value; | |
| 28 | + public $default_value; | |
| 29 | 29 | |
| 30 | 30 | /** @var string */ |
| 31 | 31 | public $group_id; |
| 32 | 32 | |
| 33 | - /** @var ?array{ $el_type: string, $widget_type: string, $prop_key: string } */ | |
| 34 | - public $origin_prop_fields = null; | |
| 35 | - | |
| 36 | 33 | public function __construct( array $overridable_prop ) { |
| 37 | 34 | $this->override_key = $overridable_prop['overrideKey']; |
| 38 | 35 | $this->element_id = $overridable_prop['elementId']; |
| 39 | 36 | $this->el_type = $overridable_prop['elType']; |
| @@ -39,45 +36,12 @@ | ||
| 39 | 36 | $this->el_type = $overridable_prop['elType']; |
| 40 | 37 | $this->widget_type = $overridable_prop['widgetType']; |
| 41 | 38 | $this->prop_key = $overridable_prop['propKey']; |
| 42 | 39 | $this->label = $overridable_prop['label']; |
| 43 | - $this->origin_value = $overridable_prop['originValue']; | |
| 40 | + $this->default_value = $overridable_prop['defaultValue']; | |
| 44 | 41 | $this->group_id = $overridable_prop['groupId'] ?? null; |
| 45 | - | |
| 46 | - if ( isset( $overridable_prop['originPropFields'] ) ) { | |
| 47 | - $this->origin_prop_fields = [ | |
| 48 | - 'el_type' => $overridable_prop['originPropFields']['elType'], | |
| 49 | - 'widget_type' => $overridable_prop['originPropFields']['widgetType'], | |
| 50 | - 'prop_key' => $overridable_prop['originPropFields']['propKey'], | |
| 51 | - 'element_id' => $overridable_prop['originPropFields']['elementId'], | |
| 52 | - ]; | |
| 53 | - } | |
| 54 | 42 | } |
| 55 | 43 | |
| 56 | 44 | public static function make( array $overridable_prop ): self { |
| 57 | 45 | return new self( $overridable_prop ); |
| 58 | - } | |
| 59 | - | |
| 60 | - public function to_associative_array(): array { | |
| 61 | - $result = [ | |
| 62 | - 'overrideKey' => $this->override_key, | |
| 63 | - 'elementId' => $this->element_id, | |
| 64 | - 'elType' => $this->el_type, | |
| 65 | - 'widgetType' => $this->widget_type, | |
| 66 | - 'propKey' => $this->prop_key, | |
| 67 | - 'label' => $this->label, | |
| 68 | - 'originValue' => $this->origin_value, | |
| 69 | - 'groupId' => $this->group_id, | |
| 70 | - ]; | |
| 71 | - | |
| 72 | - if ( $this->origin_prop_fields ) { | |
| 73 | - $result['originPropFields'] = [ | |
| 74 | - 'elType' => $this->origin_prop_fields['el_type'], | |
| 75 | - 'widgetType' => $this->origin_prop_fields['widget_type'], | |
| 76 | - 'propKey' => $this->origin_prop_fields['prop_key'], | |
| 77 | - 'elementId' => $this->origin_prop_fields['element_id'], | |
| 78 | - ]; | |
| 79 | - } | |
| 80 | - | |
| 81 | - return $result; | |
| 82 | 46 | } |
| 83 | 47 | } |