[FEATURE] A Repeatable Custom Field#20243
Conversation
|
What are the advantages/differences over this field and the existing list field? |
|
As its a new core plugin it needs to be added to the list in libraries/src/Extension/ExtensionHelper.php |
|
@roland-d Why do not you want to make a separate plugin and add it to JED ? The field looks quite useful and will probably be in demand Why do you need to add it to the core ? |
|
@brianteeman The distinct difference between these two is that with list you need to create the list when you create the custom field and is shown as select list to the end user. Displaylist allows the end user to create a list rather than make a selection. I hope that explains it. @Septdir I don't want to maintain an extension on the JED. The field seems useful enough for the community, so I figured I share it. |
|
As we do have a list already, I would rather see a new function in core to define a default layout for the field and provide different layouts for the same field type. For the list it would mean to add a new file here like /plugins/fields/list/tmpl/list_ul.php and then provide these layouts as option in the field. What do you guys think? |
|
thanks @roland-d makes sense now - which it should have done because the name is perfect - sorry |
|
@laoneo something like |
|
Or like what we have as layouts in modules and views. |
|
@laoneo I thought of adding options to select which layout it would have but for new decided against it because the output is generally styled via a template anyway. So I figured, why add even more options. |
| type="text" | ||
| icon="list" | ||
| label="PLG_FIELDS_DISPLAYLIST_PARAMS_LIST_NAME_LABEL" | ||
| description="PLG_FIELDS_DISPLAYLIST_PARAMS_LIST_NAME_DESC" |
There was a problem hiding this comment.
Reduce by 1 indent.
Sort in this order: name, type, label and description
@roland-d I think he meant not to add this new field but to add this as a layout to the current select list field |
| ; Note : All ini files need to be saved as UTF-8 | ||
|
|
||
| PLG_FIELDS_DISPLAYLIST="Fields - Display List" | ||
| PLG_FIELDS_DISPLAYLIST_LABEL="Display List (%s)" |
There was a problem hiding this comment.
@Quy Yes this is utilized. This string is used in the list where you select the field when creating a new custom field.
|
@brianteeman Ok, if that is what he meant than that would be a feature based on the existing list field and serves a different purpose. |
| description="PLG_FIELDS_DISPLAYLIST_PARAMS_LIST_NAME_DESC" | ||
| icon="list" | ||
| multiple="true" | ||
| > |
There was a problem hiding this comment.
Change this to /> and delete </field>.
|
Whats the difference of this plugin to the list field? Only the layout or not? The rest is more or less the same. |
|
@laoneo Apparently my two tries so far have failed to make clear what this plugin does different so going to give it another try. It is not the layout, otherwise I would have added that as an option to the list. Here is an image to show you the difference: The existing List is a dropdown, the new Display List allows the one consuming the article to enter a list by themselves rather than having to choose from a fixed list. This can be a usergroup that has no access to maintain the custom fields but has access to create articles. To me this is a distinct difference between these two fields. |
|
I think this would be nice, and a feature that a lot of folk would find useful. Perhaps an addition to the existing list plugin, with an option of choosing tmpl output. So, perhaps to go with the list.php we could add a ul.php and a li.php, and a way of choosing the display when editing the list, as per template overrides. |
|
@roland-d i get it |
|
@roland-d yes, the read-only extra removed confusion. Works well. |
|
I have tested this item ✅ successfully on 675d0a7 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20243. |
| // Setting the value for the field and the item | ||
| $model->setFieldValue($field->id, $item->get('id'), $value); | ||
| } | ||
| // Setting the value for the field and the item |
There was a problem hiding this comment.
The comment is the same as below. Intentional?
There was a problem hiding this comment.
@Quy Wasn't intentional, cleaned up the code a bit and pushed it
| PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_TEXT="Text" | ||
| PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_TEXTAREA="Text Area" | ||
| PLG_FIELDS_REPEATABLE_PARAMS_FIELDS_DESC="Add one or more form fields" | ||
| PLG_FIELDS_REPEATABLE_PARAMS_FIELDS_LABEL="Form fields" |
| PLG_FIELDS_REPEATABLE="Fields - Repeatable" | ||
| PLG_FIELDS_REPEATABLE_LABEL="Repeatable (%s)" | ||
| PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_NAME_DESC="The name of the field to display in the form" | ||
| PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_NAME_LABEL="Fieldname" |
There was a problem hiding this comment.
How about Field Name or just Name?
There was a problem hiding this comment.
Renamed it to Name
| name="fieldtype" | ||
| type="list" | ||
| label="PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_LABEL" | ||
| description="PLG_FIELDS__REPEATABLE_PARAMS_FIELDNAME_TYPE_DESC" |
There was a problem hiding this comment.
Remove the extra underscore in PLG_FIELDS__REPEATABLE.
Are icon and multiple attributes necessary here?
There was a problem hiding this comment.
Not needed, removed them.
| type="text" | ||
| label="PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_NAME_LABEL" | ||
| description="PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_NAME_DESC" | ||
| icon="list" |
There was a problem hiding this comment.
Are icon and multiple attributes necessary here?
There was a problem hiding this comment.
Not needed, removed them.
Removed obsolete form field settings
|
I have tested this item ✅ successfully on f6542e0 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20243. |
|
I have tested this item ✅ successfully on e13a749 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20243. |
|
Why is only one Test count as successful? |
|
With the number of tests this PR has gotten and the last commit being trivial one could say it has had enough tests ;) |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20243. |
|
Merged to 3.9 via 327fa65 |
|
For the people who are requesting a layout chooser per field, It got merged today by #18571. |
|
Hello, this is a separate issue. The styling just doesn't fit. |
|
Sorry for the late testing... But if you use 2 editor fields with JCE you can't type in into the second editor field. I know it's not core related (With TinyMCE everything works fine) but maybe something that can be still fixed? |
|
Created the issue and will post the JCE one also towards JCE ;) |
|
I'm going to lock this one. If there are followup issues, please open a new issue or pull request. Thanks for understanding. |



Summary of Changes
This pull request adds a new custom field to the core of Joomla. This custom field is called Repeatable because it allows users to enter a repeatable list of items which in turn are by default shown as a list. With a template override you can do a whole lot of other things with this.
Testing Instructions
Installation
Usage
There you have a it. Users can now create their own lists. If you are creative, you can use it to make tables or other kinds of lists.
Feedback
Let me know if this is something to be considered for core. If not, I will just close this request.