User tests: Successful: Unsuccessful:
The custom fields plugin is a welcome addition to Joomla but its usefulness is limited by a lack of configurability.
For instance you can only display custom fields in com_content within the single article view.
This PR adds a new config option to config.xml for com_content to allow the site admin user to choose other contexts where they may wish the fields to be available or displayed e.g. for com_content.featured. The mechanism can easily be extended to other components using the fields plugin.
The PR also reduces DB queries in "list views" when custom fields are not required.
Open com_content config and on Integrations tab select 'Featured articles view' as one of the output contexts for custom fields.
Featured articles page will now show custom fields.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_content Language & Strings Front End Plugins |
Labels |
Added:
?
?
|
For instance you can only display custom fields in com_content within the single article view.
That's not true. The featured view as well as category view will show the fields as well.
This PR adds a new config option to config.xml for com_content to allow the site admin user to choose other contexts where they may wish the fields to be available or displayed e.g. for com_content.featured. The mechanism can easily be extended to other components using the fields plugin.
Please don't check component parameters within the fields plugin. That plugin shouldn't be aware of the components and the components should be aware of the fields plugin.
If you want to limit the fields functionality to certain views, it's probably best to use overrides anyway, but if you really want to add such a parameter, it should go to the component helper. Look at the validateSection method in https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/helpers/content.php#L228
If you return null there, the fields will not be parsed. So if you add the parameter there, you can already control fields (and all future code which may use that method).
This way you don't have to mess with the fields plugin at all.
My mistake - sorry. My code base wasn't up to date and I hadn't picked up the changes to validateSection in the last few weeks :(
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-03-06 14:43:12 |
Closed_By | ⇒ | GeraintEdwards |
@GeraintEdwards i have just fixed the codestyle errors.