? Pending

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
26 Jul 2018

As title says.

Summary of Changes

Added addfieldprefix="Joomla\Component\Fields\Administrator\Field" for the com_contact/category/default.xml

Testing Instructions

Create a List Contacts in a Category menu item
Look at User Custom Fields in the Contact Display Options tab
It is empty instead of defaulting to All

Save the menu item.
PHP log error:
[26-Jul-2018 11:29:33 Europe/Berlin] PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in .../layouts/joomla/form/field/text.php on line 96
Look at the field: it contains the html of the error.

After patch

Click on `All'
screen shot 2018-07-26 at 12 02 04

Save. No more error.

Simple change. Can be merged on review.

avatar infograf768 infograf768 - open - 26 Jul 2018
avatar infograf768 infograf768 - change - 26 Jul 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Jul 2018
Category Front End com_contact
avatar infograf768
infograf768 - comment - 26 Jul 2018

Restarted drone...

avatar brianteeman
brianteeman - comment - 26 Jul 2018

I do not believe that this should be merged just on code review. We need to find out what changed in the code to cause this error first. If we don't find the cause we cannot be certain that this is the only place effected by that change or even if that change was correct. We have to stop just applying band-aid solutions and get to the root of the problem.

avatar infograf768
infograf768 - comment - 26 Jul 2018

GRRR... When one does not know, one does not talk.
The error is obvious and if, again, instead of trying to demolish whatever some people do, you were looking at the code and tried to understand the issue, you would have just kept your mouth shut.
I suggest you look at wherever the fieldgroups type is used in core and you will see that the code I added IS necessary.
The line missing is just an error. The solution is not a bandaid. Period.

avatar brianteeman
brianteeman - comment - 26 Jul 2018

Please stop with the personal attacks and read what I wrote

avatar SharkyKZ
SharkyKZ - comment - 26 Jul 2018

Instead of adding new line, fix existing:

addfieldpath="/administrator/components/com_fields/models/fields">

While at it, could you also change or remove this:
addfieldpath="/administrator/components/com_contact/models/fields"

/models/fields folders don't exist in 4.0.

avatar ggppdk
ggppdk - comment - 26 Jul 2018

Well the field is name-spaced we either have to hard-code all the namespaces inside the JForm class

use Joomla\Component\Fields\Administrator\Field
...
  • or we will use addfieldprefix="..." inside the XML files which will be used by JForm to load the correct field from the correct place

Commit
infograf768@ba02226#diff-419ad9989292871e19cda98184ab834a

added definition of appropriate namespace but
it only added it to the

<fields name="request"> ...</fields>

The fieldset that contains the field is not inside the <fields> , it is outside of it
and it should be changed also from

		<fieldset name="contact" label="COM_CONTACT_BASIC_OPTIONS_FIELDSET_LABEL"
			addfieldpath="/administrator/components/com_fields/models/fields"
			>

to

		<fieldset name="contact" label="COM_CONTACT_BASIC_OPTIONS_FIELDSET_LABEL"
			addfieldprefix="Joomla\Component\Fields\Administrator\Field"
			>
avatar ggppdk
ggppdk - comment - 26 Jul 2018

This PR is correct / needed, but better change the fieldset ?

avatar laoneo
laoneo - comment - 26 Jul 2018

@ggppdk solution is better as the addfieldpath is not used anymore in J4.

avatar infograf768
infograf768 - comment - 26 Jul 2018

@ggppdk @laoneo

https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_contact/config.xml#L339-L348
https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_contact/forms/contact.xml#L663-L672
https://github.com/joomla/joomla-cms/blob/4.0-dev/components/com_contact/tmpl/contact/default.xml#L318-L327

As all fieldsgroups fields use directly addfieldprefix="Joomla\Component\Fields\Administrator\Field" in the field itself, I have preferred that solution over adding it in fieldset.

My idea was that if we need this only once, it is a better solution, as it shows precisely in the field itself where we need to load the field from instead of using it in the fieldset as we have here (and is anyway broken now in 4.0).

<fieldset name="contact" label="COM_CONTACT_BASIC_OPTIONS_FIELDSET_LABEL"
			addfieldpath="/administrator/components/com_fields/models/fields">

Here indeed is a good example as it is the only field needing the load in that fieldset

I agree we have a lot of remaining addfieldpath that should be taken care of, but this PR here is specific to solve an obvious bug and I suggest we take care of them in another PR where we would normalize this behavior.

What do you think?

avatar brianteeman
brianteeman - comment - 26 Jul 2018

Guess it wasn't such an obvious fix after all and your personal attack was exactly that

avatar infograf768
infograf768 - comment - 26 Jul 2018

...

avatar laoneo
laoneo - comment - 26 Jul 2018

It doesn't mater if the addfieldprefix is added per field or on a fieldset, because it is added internally to the same scope.

avatar infograf768
infograf768 - comment - 27 Jul 2018

@laoneo Then please merge. Then someone can make a patch for the addfieldpath

avatar ggppdk ggppdk - test_item - 27 Jul 2018 - Tested successfully
avatar ggppdk
ggppdk - comment - 27 Jul 2018

I have tested this item successfully on 1cc4136

Since i have tested this, i am posting a successful test

Before patch the error described (field is not found / not loaded),
after patch a select list with 'All' plus the field groups of users (not the field groups of contacts) appear


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

avatar laoneo
laoneo - comment - 27 Jul 2018

Better to replace the addfieldpath with addfieldprefix. It makes no sense to merge this one and then to revert it with the followup pr. Better to do it right from the beginning.

avatar infograf768
infograf768 - comment - 27 Jul 2018

I would not have reverted it with the following PR. I would just have taken out the addfieldpath in that case, as I think we should do when only ONE field in the fieldset is concerned by the load See #21261 (comment)

Basically, the idea is that we should reserve adding in the fieldset when there are multiple type fields who need it in it.

avatar infograf768 infograf768 - change - 27 Jul 2018
Labels Added: ?
avatar laoneo laoneo - close - 27 Jul 2018
avatar laoneo laoneo - merge - 27 Jul 2018
avatar laoneo laoneo - change - 27 Jul 2018
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-07-27 07:12:38
Closed_By laoneo
avatar laoneo
laoneo - comment - 27 Jul 2018

Thanks.

Add a Comment

Login with GitHub to post a comment