? Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
30 Mar 2020

Summary of Changes

com_fields does support multiple custom fields in one plugin. Unfortunately the layout path lookup doesn't work as intended. This pr adds an additional lookup for the plugin, which is actually the correct way.

Testing Instructions

  • Copy the file /plugins/fields/text/tmpl/text.php to /plugins/fields/text/tmpl/text2.php
  • Create a new article custom field of type text 2
  • Create an article and set a value for the field text 2
  • Open the article on the front

Expected result

The value of text 2 is displayed.

Actual result

An error is thrown:
/plugins/fields/text2/tmpl/default.php: failed to open stream: No such file or directory in /administrator/components/com_fields/libraries/fieldsplugin.php

avatar laoneo laoneo - open - 30 Mar 2020
avatar laoneo laoneo - change - 30 Mar 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Mar 2020
Category Administration com_fields
avatar wilsonge
wilsonge - comment - 30 Mar 2020

Is there any reason we need to support the old path and not just use the better way if it's currently broken?

avatar laoneo
laoneo - comment - 30 Mar 2020

The only reason I see is BC.

avatar wilsonge
wilsonge - comment - 30 Mar 2020

But the b/c break would be if plugins were loading their field templates from other plugins right?

avatar laoneo
laoneo - comment - 30 Mar 2020

This one here is about the lookup itself in the plugin. When the type differs from the name then it would not work anymore if we replace the original lookup.

avatar astridx
astridx - comment - 31 Mar 2020

I have tested this item successfully on 523c53c

I like this solution. The old broken solution can still be deleted by a separate PR if desired.
Thank you @laoneo, with this PR I have learned how I hopefully can solve something a little easier. I've always helped myself with overrides for my own custom field.


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

avatar astridx astridx - test_item - 31 Mar 2020 - Tested successfully
avatar laoneo laoneo - change - 1 Apr 2020
Labels Added: ?
avatar viocassel
viocassel - comment - 1 Apr 2020

I have tested this item successfully on 5f99b67


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

avatar viocassel viocassel - test_item - 1 Apr 2020 - Tested successfully
avatar astridx
astridx - comment - 1 Apr 2020

I have tested this item successfully on 5f99b67


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

avatar astridx astridx - test_item - 1 Apr 2020 - Tested successfully
avatar astridx astridx - test_item - 1 Apr 2020 - Tested successfully
avatar HLeithner
HLeithner - comment - 1 Apr 2020

@laoneo wouldn't that mean that the first layout that gets loaded is wrong and should be deprecated and loading the name would be the first try? Maybe change this in J4?

avatar laoneo
laoneo - comment - 1 Apr 2020

@HLeithner in J4 we can change that. But I need this fix in J3 as well.

avatar HLeithner HLeithner - change - 1 Apr 2020
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-04-01 13:50:06
Closed_By HLeithner
avatar HLeithner HLeithner - close - 1 Apr 2020
avatar HLeithner HLeithner - merge - 1 Apr 2020
avatar HLeithner
HLeithner - comment - 1 Apr 2020

Thanks

avatar wilsonge
wilsonge - comment - 1 Apr 2020

@laoneo when this gets merged up to 4.0 you able to do the second part of the PR there (removing the old set of paths)

avatar laoneo
laoneo - comment - 1 Apr 2020

Sure. I can even do it now so we wont forget.

avatar laoneo
laoneo - comment - 1 Apr 2020

New pr is #28534.

Add a Comment

Login with GitHub to post a comment