Skip to content

Commit 21aa5c0

Browse files
authored
Merge pull request #1630 from craftcms/bugfix/1626-matrix-field-without-data-for-fields
only ignore the block if title and slug are not being set either
2 parents 4004e64 + fa0056b commit 21aa5c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/fields/Matrix.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public function parseField(): mixed
230230
$index = 1;
231231
$resultBlocks = [];
232232
foreach ($expanded as $blockData) {
233-
// if all the fields are empty and setEmptyValues is off, ignore the block
233+
// if all the fields are empty and setEmptyValues is off and there's no title or slug being set, ignore the block
234234
if (
235235
!empty(array_filter(
236236
$blockData['fields'],
@@ -240,7 +240,8 @@ public function parseField(): mixed
240240
is_bool($value) ||
241241
is_numeric($value)
242242
)
243-
))
243+
)) ||
244+
(!empty($blockData['title']) || !empty($blockData['slug']))
244245
) {
245246
$resultBlocks['new' . $index++] = $blockData;
246247
}

0 commit comments

Comments
 (0)