Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions resources/css/components/fieldtypes/grid.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
47 changes: 47 additions & 0 deletions tests/Fieldtypes/GridTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}
Loading