Skip to content

Commit 5f6b0af

Browse files
committed
save empty array when no content is provided in blocks formwidget
1 parent 1db24de commit 5f6b0af

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

formwidgets/Blocks.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function render()
7272
protected function processSaveValue($value)
7373
{
7474
if (!is_array($value) || !$value) {
75-
return $value;
75+
return null;
7676
}
7777

7878
$count = count($value);

formwidgets/blocks/partials/_block.php

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
data-sortable-handle=".<?= $this->getId('items') ?>-handle"
1313
<?php endif; ?>
1414
>
15+
<?php if (!$this->previewMode): ?>
16+
<input type="hidden" name="<?= $this->getFieldName(); ?>">
17+
<?php endif ?>
18+
1519
<ul id="<?= $this->getId('items') ?>" class="field-repeater-items">
1620
<?php foreach ($formWidgets as $index => $widget) : ?>
1721
<?= $this->makePartial('block_item', [

0 commit comments

Comments
 (0)