? ? Pending

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
30 Jan 2017

Pull Request for Issue #13805 .

Summary of Changes

This PR adds a new content plugin "fields" which will replace a plugin tag {field 2} into the rendered output for the field with the ID "2".
It also supports the tag {fieldgroup 3} which would give you all fields in the group with the ID "3".

Testing Instructions

  • Apply PR and discover and enable the plugin.
  • Edit an article and enter the plugin tag as described above with the ID of an existing field.

Expected result

The field(s) will be rendered at the place where the tag was set.

Documentation Changes Required

Dunno. Maybe add documentation about this new plugin if other such plugins are documented.

Remarks

Ideally there would be an accompagning editor button (could use help here as JS isn't my strenght)

This is now ready for testing.

avatar Bakual Bakual - open - 30 Jan 2017
avatar Bakual Bakual - change - 30 Jan 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Jan 2017
Category Administration Language & Strings Front End Plugins
avatar laoneo
laoneo - comment - 31 Jan 2017

When rendering only a {field 23} tag, then I don't see the benefit to have such a plugin. It's faster to just add the value into the description of the article directly instead of creating a field, setting the value when editing an article and then using that field inside the article description.
With mustache we had looping and basic conditional functionality and this was the great benefit mostly people liked about it in DPFields.

avatar Bakual
Bakual - comment - 31 Jan 2017

When rendering only a {field 23} tag, then I don't see the benefit to have such a plugin. It's faster to just add the value into the description of the article directly instead of creating a field, setting the value when editing an article and then using that field inside the article description.

For a simple text field, I would agree. For a more complex field like the gallery, it's certainly not the case.

With mustache we had looping and basic conditional functionality and this was the great benefit mostly people liked about it in DPFields.

As I wrote we can expand that plugin to allow including of fieldgroups. Then you can include a group of fields, more or less what DPField does with the looping (if I understood it right). The conditionals can and should be done in the respective JLayout then if needed. Best would be if they are not needed at all, eg by using the render class.

avatar rdeutz
rdeutz - comment - 31 Jan 2017

Seems to me a good addition. +1 on fieldgroups.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 31 Jan 2017

tested on Picture-Gallery, works well and fine Enhancement.

But got Gallery 2 times: One by Field itself, one by {field id} in Articletext.

avatar Bakual Bakual - change - 31 Jan 2017
Labels Added: ? ?
avatar Bakual
Bakual - comment - 31 Jan 2017

@franz-wohlkoenig Try changing the "Automatic Display" to "No" in the field. Then it should only appear once.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 31 Jan 2017

@Bakual thanks, works. PR is not for testing now?

avatar Bakual
Bakual - comment - 31 Jan 2017

@franz-wohlkoenig It's not ready to be merged, but can be tested and given feedback as you did.
There are some issues that need to be fixed first (eg the missing SQL files) and the fieldgroup option should be in as well. I'll try to do that today but can't promise :)

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 31 Jan 2017

@Bakual give a go if ready for test.

avatar joomla-cms-bot joomla-cms-bot - change - 31 Jan 2017
Category Administration Language & Strings Front End Plugins SQL Administration com_admin Postgresql MS SQL Language & Strings Installation Front End Plugins
avatar Bakual
Bakual - comment - 31 Jan 2017

@franz-wohlkoenig Go ?

Added support for fieldgroups: {fieldgroup 1} will render all fields for the group with the ID 1.
Added SQL files.

avatar Bakual Bakual - change - 31 Jan 2017
The description was changed
avatar Bakual Bakual - edited - 31 Jan 2017
avatar Bakual Bakual - change - 31 Jan 2017
The description was changed
avatar Bakual Bakual - edited - 31 Jan 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 31 Jan 2017

@Bakual {field *} and {fieldgroup *} works well (also both at same time in one Article).

avatar Bakual
Bakual - comment - 31 Jan 2017

@franz-wohlkoenig Can you add then a successful test please?

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 31 Jan 2017

I have tested this item successfully on b808001


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13814.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 31 Jan 2017 - Tested successfully
avatar laoneo
laoneo - comment - 1 Feb 2017

Would it be then also possible to support a {fields} tag? Or is {fieldgroup *} already doing that?

avatar Bakual
Bakual - comment - 1 Feb 2017

Would it be then also possible to support a {fields} tag? Or is {fieldgroup *} already doing that?

You mean to include all fields? Do you think there is a need for that which can't be solved by using fieldgroups already?
Currently there is no such functionality but I think it could be added. Best probably by using an asterix like {field *}, I'd rather not have yet another regex possibility (eg not {fields}) as it makes that part of the code more complex.

avatar joomdonation
joomdonation - comment - 1 Feb 2017

I have a similar plugin in my own extension which support following syntax:

{membershipplans ids="*"} => it will display all published plans in the article.
{membershipplans ids="cat-3"} => It will display all subscription plans from the category with ID = 3
{membershipplans ids="2,4,5"} => It will display all subscription plans with ID = 2, 4, OR 5.

Maybe it will be more flexible if we could support the same with this plugin, so:
{fields ids="*"} => it will display all fields.
{fields ids="fieldgroup-3"} => it will display all fields belong to group with ID = 3
{fields ids="2,4,5"} => It will display all fields with ID = 2, 4, OR 5.

(I am not sure if it is needed, just comment because I have plugin does similar things in my extension)

avatar chrisdavenport
chrisdavenport - comment - 1 Feb 2017

Or you could just make use of the generic parser already written for this purpose: #11702 ?

avatar Bakual
Bakual - comment - 1 Feb 2017

@chrisdavenport If it would be merged and I had an example in how to use it, then yes ?
So far, I found it much easier to use a one-liner with a rather simple regex.

I wouldn't use a coma-separated list. It makes the code more complicate for no reason. The user can either group the fields in a fieldsgroup or use multiple {field} tags to achieve the same.
Having support for a {field *} tag should be easy to implement without having to make the code much more complex.

I also like to keep the syntax similar to the one used in the "Load Module" plugin.

avatar joomla-cms-bot joomla-cms-bot - change - 1 Feb 2017
Category Administration Language & Strings Front End Plugins SQL com_admin Postgresql MS SQL Installation SQL Administration com_admin Postgresql MS SQL com_content Language & Strings Installation Front End Plugins
avatar Bakual
Bakual - comment - 1 Feb 2017
  • Added support for {field *} ({fieldgroup *} also works, does exactly the same)
  • {fieldgroup 0}` also works, it will show those fields without a group

On a sidenote, I had to add featured to the validateContext method. This enables fields also in the featured view.

avatar laoneo
laoneo - comment - 2 Feb 2017

With the groups and wildcards, it becomes very powerful. I'm just wondering if a different layout should be used then, eg fields/inline.php and field/inline.php. Like that the admin can distinguish between the fields rendered trough the display event and inline in the description?

avatar Bakual
Bakual - comment - 2 Feb 2017

You already can already decide if you want to use the fields.render layout (used by {fieldgroups}) or the field.render one (used by the single field {field} tag). You can also wrap it in your custom class and have specific CSS rules apply to it. So it's quite flexible already as it is.

In theory it could expanded for example with a second parameter in the tag (eg {field 2 otherlayout}) to change the layout to a different one, but lets run with what we have for now, there is no B/C implications if we add more features to it later one.

More importantely for me is having a editor button to create that tag. Similar to the one used for the loadmodule one. That is a higher priority for me at least ?

avatar rdeutz rdeutz - change - 2 Feb 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-02-02 18:51:21
Closed_By rdeutz
avatar rdeutz rdeutz - close - 2 Feb 2017
avatar rdeutz rdeutz - merge - 2 Feb 2017

Add a Comment

Login with GitHub to post a comment