Skip to content

Commit

Permalink
default_value -> value (fix js set repeater default attrs)
Browse files Browse the repository at this point in the history
  • Loading branch information
yarovikov committed Aug 3, 2024
1 parent da95aa8 commit 54b7cfc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Editor/AbstractBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ public function getAttributes(): array
$attributes[$field_or_option['name']] = match ($field_or_option['type']) {
'Text', 'Textarea', 'Select', 'ColorPalette', 'RichText' => [
'type' => 'string',
'default' => (string) ($field_or_option['default_value'] ?? ''),
'default' => (string) ($field_or_option['value'] ?? ''),
],
'Image', 'Range' => [
'type' => 'integer',
'default' => (int) ($field_or_option['default_value'] ?? ''),
'default' => (int) ($field_or_option['value'] ?? ''),
],
'Toggle' => [
'type' => 'boolean',
'default' => (bool) ($field_or_option['default_value'] ?? ''),
'default' => (bool) ($field_or_option['value'] ?? ''),
],
'Gallery', 'Repeater' => [
'type' => 'array',
'default' => array_filter((array) ($field_or_option['default_value'] ?? [])),
'default' => array_filter((array) ($field_or_option['value'] ?? [])),
],
default => null,
};
Expand Down Expand Up @@ -227,25 +227,25 @@ public function defaultOptions(): array
'name' => 'margin_top_desktop',
'type' => 'Text',
'label' => 'Margin Top Desktop',
'default_value' => static::MARGIN_TOP_DESKTOP,
'value' => static::MARGIN_TOP_DESKTOP,
],
[
'name' => 'margin_top_mobile',
'type' => 'Text',
'label' => 'Margin Top Mobile',
'default_value' => static::MARGIN_TOP_MOBILE,
'value' => static::MARGIN_TOP_MOBILE,
],
[
'name' => 'margin_bottom_desktop',
'type' => 'Text',
'label' => 'Margin Bottom Desktop',
'default_value' => static::MARGIN_BOTTOM_DESKTOP,
'value' => static::MARGIN_BOTTOM_DESKTOP,
],
[
'name' => 'margin_bottom_mobile',
'type' => 'Text',
'label' => 'Margin Bottom Mobile',
'default_value' => static::MARGIN_BOTTOM_MOBILE,
'value' => static::MARGIN_BOTTOM_MOBILE,
],
];
}
Expand Down

0 comments on commit 54b7cfc

Please sign in to comment.