User tests: Successful: Unsuccessful:
With custom fields, we check the section part of the context if it is valid. The component can then adjust the section as needed. That is useful if the context triggered in plugin events doesn't match the field context.
If the context is unknown we usually return null
in that method.
See for example the one for com_content:
joomla-cms/administrator/components/com_content/helpers/content.php
Lines 228 to 252 in 05fd1d9
I would expect if I return null
, then custom fields would stop processing as the context is unknown to the component. However it just runs with the original context.
This PR changes the FieldsHelper::extract
method so it returns null
as well if the validate method returns null
. This will stop the calling fields code.
I'm not sure how it can be really tested. I have a failure in my extension in J4 due to this, but it is a quite specific setting.
I think it should be possible to run an onContentPrepare
event with a context com_content.foo
and debug if com_fields tries to lookup fields (should get a query at least).
The easier way is probably to just make sure custom fields still work in Content, Contact and 3rd parties.
No
@laoneo What do you think?
As a background I got an issue with the current code when I try categories with sections (with #17769 applied already) and an unknown context is passed.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_fields |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-10-06 19:33:30 |
Closed_By | ⇒ | Bakual | |
Labels |
Added:
?
Removed: ? |