From 1a5ba80b28cc0fdbc5b824e73c2be57340945066 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Fri, 17 Apr 2020 23:58:42 +0800 Subject: [PATCH] Add additional properties for repeater widget in form builder. - Style - Minimum Items - Title From Fixes #324. --- classes/StandardControlsRegistry.php | 40 +++++++++++++++++++++++++++- lang/en/lang.php | 11 ++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/classes/StandardControlsRegistry.php b/classes/StandardControlsRegistry.php index 8efb86d1..18b7ef6b 100644 --- a/classes/StandardControlsRegistry.php +++ b/classes/StandardControlsRegistry.php @@ -369,16 +369,54 @@ protected function registerRepeaterWidget() 'default' => Lang::get('rainlab.builder::lang.form.property_prompt_default'), 'sortOrder' => 81 ], + 'titleFrom' => [ + 'title' => Lang::get('rainlab.builder::lang.form.property_title_from'), + 'description' => Lang::get('rainlab.builder::lang.form.property_title_from_description'), + 'type' => 'string', + 'ignoreIfEmpty' => true, + 'sortOrder' => 82 + ], 'form' => [ 'type' => 'control-container' ], + 'minItems' => [ + 'title' => Lang::get('rainlab.builder::lang.form.property_min_items'), + 'description' => Lang::get('rainlab.builder::lang.form.property_min_items_description'), + 'type' => 'string', + 'ignoreIfEmpty' => true, + 'sortOrder' => 83, + 'validation' => [ + 'integer' => [ + 'message' => Lang::get('rainlab.builder::lang.form.property_min_items_integer'), + 'allowNegative' => false, + ] + ], + ], 'maxItems' => [ 'title' => Lang::get('rainlab.builder::lang.form.property_max_items'), 'description' => Lang::get('rainlab.builder::lang.form.property_max_items_description'), 'type' => 'string', 'ignoreIfEmpty' => true, - 'sortOrder' => 82 + 'sortOrder' => 84, + 'validation' => [ + 'integer' => [ + 'message' => Lang::get('rainlab.builder::lang.form.property_max_items_integer'), + 'allowNegative' => false, + ] + ], ], + 'style' => [ + 'title' => Lang::get('rainlab.builder::lang.form.property_style'), + 'description' => Lang::get('rainlab.builder::lang.form.property_style_description'), + 'type' => 'dropdown', + 'default' => 'default', + 'options' => [ + 'default' => Lang::get('rainlab.builder::lang.form.style_default'), + 'collapsed' => Lang::get('rainlab.builder::lang.form.style_collapsed'), + 'accordion' => Lang::get('rainlab.builder::lang.form.style_accordion'), + ], + 'sortOrder' => 85, + ] ]; $ignoreProperties = [ diff --git a/lang/en/lang.php b/lang/en/lang.php index 98d72d0b..b04f5e16 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -289,8 +289,16 @@ 'property_empty_option_description' => 'The empty option corresponds to the empty selection, but unlike the placeholder it can be reselected.', 'property_show_search' => 'Show search', 'property_show_search_description' => 'Enables the search feature for this dropdown.', + 'property_title_from' => 'Title from', + 'property_title_from_description' => 'Specify a child field name to use the value of that field as the title for each repeater item.', + 'property_min_items' => 'Min items', + 'property_min_items_description' => 'Minimum number of items to allow within the repeater.', + 'property_min_items_integer' => 'Min items must be a positive integer.', 'property_max_items' => 'Max items', 'property_max_items_description' => 'Maximum number of items to allow within the repeater.', + 'property_max_items_integer' => 'Max items must be a positive integer.', + 'property_style' => 'Style', + 'property_style_description' => 'Defines the behaviour to apply to this repeater.', 'control_group_standard' => 'Standard', 'control_group_widgets' => 'Widgets', 'click_to_add_control' => 'Add control', @@ -352,6 +360,9 @@ 'span_right' => 'Right', 'span_full' => 'Full', 'span_auto' => 'Auto', + 'style_default' => 'Default', + 'style_collapsed' => 'Collapsed', + 'style_accordion' => 'Accordion', 'empty_tab' => 'Empty tab', 'confirm_close_tab' => 'The tab contains controls which will be deleted. Continue?', 'tab' => 'Form tab',