? Pending

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
12 Jun 2017

When associations are enabled, the article form uses a custom field Modal_Article to select the article.
Due to the now namespaced field the form can't no longer find the field and displays a textfield instead.

Summary of Changes

Adds the fieldprefix of com_content to the article form. The prefix from com_categories which is needed for the catid field is moved to that specific field.
@laoneo With the old way, the "own" fieldpath is already automatically preregistered. But with namespaces that isn't the case. Do you think it's possible (and should we?) to register that automatically as well? Otherwise extensions need to specify it in each of their XMLs if they use custom fields, like I do with this PR.

Testing Instructions

  • Make sure you have a multilingual setup where associations are enabled
  • Edit an article and try to assign another article.
  • Make sure both the category select field and the article select field are working as expected.

Expected result

A field which allows to select an article from a modal

Actual result

Textfield

Documentation Changes Required

None

avatar Bakual Bakual - open - 12 Jun 2017
avatar Bakual Bakual - change - 12 Jun 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Jun 2017
Category Administration com_content
avatar Bakual Bakual - change - 12 Jun 2017
The description was changed
avatar Bakual Bakual - edited - 12 Jun 2017
avatar wilsonge
wilsonge - comment - 12 Jun 2017

This looks good. leaving open for now to allow Allon to give his thoughts about the autoloading of Fields

avatar laoneo
laoneo - comment - 12 Jun 2017

I like that idea of having a prefix per form field. The thing is that we have something like that already https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/CMS/Form/FormHelper.php#L198.

In your case it adds the namespace to the global prefix array or? So if there is another field with the type categoryedit but in another namespace (Joomla\Component\Foo\Administrator\Field), then it will always takes the one from the first found one, which is in our case then the one fro com_categories. It's a very rare use case, but probably we should take care of it as well.

Do you think it's possible (and should we?) to register that automatically as well?

IMO not, because then you can't use the XML file standalone. I know the use cases are rare, but like we have it now, you can use the form file in any extension and it works out of the box. All is set up by itself trough declaration in the XML file which I like.

avatar Bakual
Bakual - comment - 12 Jun 2017

I like that idea of having a prefix per form field.

I didn't invent that. It is already possible in J3 to add a fieldpath per field and I think it's even used in core (don't remember where). Adding a prefix per field seems to work fine as well. Don't ask me how that works ?

In your case it adds the namespace to the global prefix array or? So if there is another field with the type categoryedit but in another namespace (Joomla\Component\Foo\Administrator\Field), then it will always takes the one from the first found one, which is in our case then the one fro com_categories. It's a very rare use case, but probably we should take care of it as well.

Honestly, I have no clue. As said, I didn't write that feature. I just used it ?

avatar laoneo
laoneo - comment - 12 Jun 2017

Yes, it is done globally here https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/CMS/Form/Form.php#L1974. So for me it is fine to merge it that way. We need to improve the Form documentation, so many hidden features.

@wilsonge good to merge.

avatar wilsonge wilsonge - change - 12 Jun 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-06-12 11:31:58
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 12 Jun 2017
avatar wilsonge wilsonge - merge - 12 Jun 2017

Add a Comment

Login with GitHub to post a comment