Skip to content
Merged
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
1 change: 1 addition & 0 deletions lang/en/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
'link.config.collections' => 'Entries from these collections will be available. Leaving this empty will make entries from routable collections available.',
'link.config.container' => 'Choose which asset container to use for this field.',
'link.title' => 'Link',
'list.config.add_row' => 'Customize the label of the "Add Item" button.',
'list.title' => 'List',
'markdown.config.automatic_line_breaks' => 'Enables automatic line breaks.',
'markdown.config.automatic_links' => 'Enables automatic linking of any URLs.',
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/fieldtypes/ListFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default {

computed: {
addButton() {
return __(this.config.add_button || 'Add Item');
return __(this.config.add_row) || __(this.config.add_button) || __('Add Item');
},
},

Expand Down
6 changes: 6 additions & 0 deletions src/Fieldtypes/Lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ protected function configFieldItems(): array
'instructions' => __('statamic::messages.fields_default_instructions'),
'type' => 'list',
],
'add_row' => [
'display' => __('Add Row Label'),
'instructions' => __('statamic::fieldtypes.list.config.add_row'),
'type' => 'text',
'placeholder' => __('Add Item'),
],
];
}

Expand Down
9 changes: 9 additions & 0 deletions tests/Fieldtypes/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ public function it_processes()
);
}

#[Test]
public function it_has_add_row_config()
{
$configFields = (new \ReflectionMethod(Lists::class, 'configFieldItems'))->invoke(new Lists);

$this->assertArrayHasKey('add_row', $configFields);
$this->assertSame('text', $configFields['add_row']['type']);
}

private function field($config = [])
{
$ft = new Lists;
Expand Down
Loading