Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Antlers toggle to config of Text Fieldtypes #2891

Merged
merged 2 commits into from
Nov 23, 2020
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 resources/lang/en/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
return [
'any.config.cast_booleans' => 'Options with values of true and false will be saved as booleans.',
'any.config.default' => 'Set the default value.',
'any.config.antlers' => 'Toggle if you\'d like this field to be parsed by Antlers.',
'array.config.keys' => 'Set the array keys (variables) and optional labels.',
'array.config.mode' => 'Dynamic mode gives the user control of the data while keyed mode does not.',
'assets.config.allow_uploads' => 'Allow new file uploads.',
Expand Down
6 changes: 6 additions & 0 deletions src/Fieldtypes/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ protected function configFieldItems(): array
'type' => 'text',
'width' => 50,
],
'antlers' => [
'display' => __('Antlers'),
'instructions' => __('statamic::fieldtypes.any.config.antlers'),
'type' => 'toggle',
'width' => 50,
],
];
}

Expand Down
6 changes: 6 additions & 0 deletions src/Fieldtypes/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ protected function configFieldItems(): array
'type' => 'text',
'width' => 50,
],
'antlers' => [
'display' => __('Antlers'),
'instructions' => __('statamic::fieldtypes.any.config.antlers'),
'type' => 'toggle',
'width' => 50,
],
];
}

Expand Down
6 changes: 6 additions & 0 deletions src/Fieldtypes/Textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ protected function configFieldItems(): array
'instructions' => __('statamic::fieldtypes.text.config.character_limit'),
'type' => 'text',
],
'antlers' => [
'display' => __('Antlers'),
'instructions' => __('statamic::fieldtypes.any.config.antlers'),
'type' => 'toggle',
'width' => 50,
],
];
}

Expand Down
4 changes: 4 additions & 0 deletions tests/Fields/BlueprintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ public function converts_to_array_suitable_for_rendering_fields_in_publish_compo
'input_type' => 'text',
'prepend' => null,
'append' => null,
'antlers' => false,
],
],
],
Expand All @@ -356,6 +357,7 @@ public function converts_to_array_suitable_for_rendering_fields_in_publish_compo
'validate' => 'min:2',
'character_limit' => null,
'component' => 'textarea',
'antlers' => false,
],
],
],
Expand Down Expand Up @@ -428,6 +430,7 @@ public function converts_to_array_suitable_for_rendering_prefixed_conditional_fi
'component' => 'text',
'instructions' => null,
'required' => false,
'antlers' => false,
],
[
'handle' => 'nested_deeper_two',
Expand All @@ -442,6 +445,7 @@ public function converts_to_array_suitable_for_rendering_prefixed_conditional_fi
'component' => 'text',
'instructions' => null,
'required' => false,
'antlers' => false,
],
],
],
Expand Down
4 changes: 4 additions & 0 deletions tests/Fields/FieldsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ public function converts_to_array_suitable_for_rendering_fields_in_publish_compo
'input_type' => 'text',
'prepend' => null,
'append' => null,
'antlers' => false,
],
[
'handle' => 'two',
Expand All @@ -430,6 +431,7 @@ public function converts_to_array_suitable_for_rendering_fields_in_publish_compo
'validate' => 'min:2',
'character_limit' => null,
'component' => 'textarea',
'antlers' => false,
],
], $fields->toPublishArray());
}
Expand Down Expand Up @@ -483,6 +485,7 @@ public function converts_to_array_suitable_for_rendering_prefixed_conditional_fi
'component' => 'text',
'instructions' => null,
'required' => false,
'antlers' => false,
],
[
'handle' => 'nested_deeper_two',
Expand All @@ -497,6 +500,7 @@ public function converts_to_array_suitable_for_rendering_prefixed_conditional_fi
'component' => 'text',
'instructions' => null,
'required' => false,
'antlers' => false,
],
], $fields->toPublishArray());
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Fields/SectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public function converts_to_array_suitable_for_rendering_fields_in_publish_compo
'character_limit' => 0,
'prepend' => null,
'append' => null,
'antlers' => false,
],
[
'handle' => 'two',
Expand All @@ -157,6 +158,7 @@ public function converts_to_array_suitable_for_rendering_fields_in_publish_compo
'validate' => 'min:2',
'character_limit' => null,
'component' => 'textarea',
'antlers' => false,
],
],
], $section->toPublishArray());
Expand Down
1 change: 1 addition & 0 deletions tests/Fieldtypes/NestedFieldsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public function it_preprocesses_from_blueprint_format_to_vue()
'character_limit' => 0,
'prepend' => null,
'append' => null,
'antlers' => false,
'component' => 'text',
'width' => 50,
'display' => 'Second Field',
Expand Down