From 59ebd1fe3979cea7fc677f4aa1254a0b11bcf204 Mon Sep 17 00:00:00 2001 From: Lazizbek Ergashev Date: Sun, 12 Jul 2026 19:18:34 +0500 Subject: [PATCH 1/2] Fix Replicator field labels hidden when nested in Grid --- resources/css/components/fieldtypes/grid.css | 4 ++ tests/Fieldtypes/GridTest.php | 47 ++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/resources/css/components/fieldtypes/grid.css b/resources/css/components/fieldtypes/grid.css index af124fd9631..a37c2779f82 100644 --- a/resources/css/components/fieldtypes/grid.css +++ b/resources/css/components/fieldtypes/grid.css @@ -84,6 +84,10 @@ .grid-cell :is([data-ui-field-header], [data-ui-label], [data-ui-description]) { @apply hidden; } + + .grid-cell :is(.replicator-fieldtype, .bard-fieldtype, .group-fieldtype) :is([data-ui-field-header], [data-ui-label], [data-ui-description]) { + @apply block; + } } tbody .grid-row-controls { diff --git a/tests/Fieldtypes/GridTest.php b/tests/Fieldtypes/GridTest.php index cb5d1e15536..d8af58c0ace 100644 --- a/tests/Fieldtypes/GridTest.php +++ b/tests/Fieldtypes/GridTest.php @@ -598,4 +598,51 @@ public function augment($value) $this->assertEquals('test.-1.words', $value['new']['words']['fieldPathPrefix']); $this->assertEquals('test.-1.words', $value['defaults']['words']); } + + #[Test] + public function it_allows_replicator_nested_inside_grid() + { + FieldRepository::shouldReceive('find') + ->with('testfieldset.text') + ->andReturnUsing(function () { + return new Field('text', ['type' => 'text']); + }); + + $field = (new Field('test', [ + 'type' => 'grid', + 'fields' => [ + ['handle' => 'title', 'field' => ['type' => 'text']], + ['handle' => 'blocks', 'field' => [ + 'type' => 'replicator', + 'sets' => [ + [ + 'handle' => 'block_one', + 'display' => 'Block One', + 'fields' => [ + ['handle' => 'content', 'field' => 'testfieldset.text'], + ], + ], + ], + ]], + ], + ]))->setValue([ + [ + 'title' => 'Row 1', + 'blocks' => [ + [ + 'type' => 'block_one', + 'content' => 'Some content', + ], + ], + ], + ]); + + $preprocessed = $field->preProcess()->value(); + + $this->assertCount(1, $preprocessed); + $this->assertEquals('Row 1', $preprocessed[0]['title']); + $this->assertIsArray($preprocessed[0]['blocks']); + $this->assertEquals('block_one', $preprocessed[0]['blocks'][0]['type']); + $this->assertEquals('Some content', $preprocessed[0]['blocks'][0]['content']); + } } From 1ab4d4519e63ef371c514a735b3d894040d65475 Mon Sep 17 00:00:00 2001 From: lazerg Date: Wed, 15 Jul 2026 21:49:46 +0500 Subject: [PATCH 2/2] Fix nested Grid cell labels re-appearing inside Replicator/Bard/Group, drop non-functional test --- resources/css/components/fieldtypes/grid.css | 5 +++ tests/Fieldtypes/GridTest.php | 47 -------------------- 2 files changed, 5 insertions(+), 47 deletions(-) diff --git a/resources/css/components/fieldtypes/grid.css b/resources/css/components/fieldtypes/grid.css index a37c2779f82..c1c5a1ea33d 100644 --- a/resources/css/components/fieldtypes/grid.css +++ b/resources/css/components/fieldtypes/grid.css @@ -88,6 +88,11 @@ .grid-cell :is(.replicator-fieldtype, .bard-fieldtype, .group-fieldtype) :is([data-ui-field-header], [data-ui-label], [data-ui-description]) { @apply block; } + + /* ...unless that container fieldtype has its own nested Grid cell, whose direct labels should stay hidden per the rule above. */ + .grid-cell :is(.replicator-fieldtype, .bard-fieldtype, .group-fieldtype) .grid-cell :is([data-ui-field-header], [data-ui-label], [data-ui-description]) { + @apply hidden; + } } tbody .grid-row-controls { diff --git a/tests/Fieldtypes/GridTest.php b/tests/Fieldtypes/GridTest.php index d8af58c0ace..cb5d1e15536 100644 --- a/tests/Fieldtypes/GridTest.php +++ b/tests/Fieldtypes/GridTest.php @@ -598,51 +598,4 @@ public function augment($value) $this->assertEquals('test.-1.words', $value['new']['words']['fieldPathPrefix']); $this->assertEquals('test.-1.words', $value['defaults']['words']); } - - #[Test] - public function it_allows_replicator_nested_inside_grid() - { - FieldRepository::shouldReceive('find') - ->with('testfieldset.text') - ->andReturnUsing(function () { - return new Field('text', ['type' => 'text']); - }); - - $field = (new Field('test', [ - 'type' => 'grid', - 'fields' => [ - ['handle' => 'title', 'field' => ['type' => 'text']], - ['handle' => 'blocks', 'field' => [ - 'type' => 'replicator', - 'sets' => [ - [ - 'handle' => 'block_one', - 'display' => 'Block One', - 'fields' => [ - ['handle' => 'content', 'field' => 'testfieldset.text'], - ], - ], - ], - ]], - ], - ]))->setValue([ - [ - 'title' => 'Row 1', - 'blocks' => [ - [ - 'type' => 'block_one', - 'content' => 'Some content', - ], - ], - ], - ]); - - $preprocessed = $field->preProcess()->value(); - - $this->assertCount(1, $preprocessed); - $this->assertEquals('Row 1', $preprocessed[0]['title']); - $this->assertIsArray($preprocessed[0]['blocks']); - $this->assertEquals('block_one', $preprocessed[0]['blocks'][0]['type']); - $this->assertEquals('Some content', $preprocessed[0]['blocks'][0]['content']); - } }