User tests: Successful: Unsuccessful:
As title says.
Added addfieldprefix="Joomla\Component\Fields\Administrator\Field"
for the com_contact/category/default.xml
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.
Save. No more error.
Simple change. Can be merged on review.
Status | New | ⇒ | Pending |
Category | ⇒ | Front End com_contact |
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.
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.
Please stop with the personal attacks and read what I wrote
Instead of adding new line, fix existing:
/models/fields
folders don't exist in 4.0.
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
...
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"
>
This PR is correct / needed, but better change the fieldset ?
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?
Guess it wasn't such an obvious fix after all and your personal attack was exactly that
...
It doesn't mater if the addfieldprefix is added per field or on a fieldset, because it is added internally to the same scope.
I have tested this item
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
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.
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.
Labels |
Added:
?
|
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-07-27 07:12:38 |
Closed_By | ⇒ | laoneo |
Thanks.
Restarted drone...