-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.3] Run content plugins on custom fields values #44233
Draft
rdeutz
wants to merge
4
commits into
joomla:5.3-dev
Choose a base branch
from
rdeutz:prepare-field-content-option
base: 5.3-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fedik
reviewed
Oct 11, 2024
$subject = new stdClass; | ||
$subject->text = $value; | ||
|
||
$dispatcher->dispatch('onContentPrepare', new ContentPrepareEvent('onContentPrepare', ['com_content.fields', $subject])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use HTMLHelper::_('content.prepare', $value, '', 'blabla.context');
, as it is done in:
($data['module'])->content = HTMLHelper::_('content.prepare', ($data['module'])->content, '', 'mod_custom.content'); |
and many other places.
brianteeman
reviewed
Oct 11, 2024
richard67
reviewed
Oct 13, 2024
administrator/components/com_fields/src/Helper/FieldsHelper.php
Outdated
Show resolved
Hide resolved
richard67
reviewed
Oct 13, 2024
administrator/components/com_fields/src/Helper/FieldsHelper.php
Outdated
Show resolved
Hide resolved
richard67
reviewed
Oct 13, 2024
administrator/components/com_fields/src/Helper/FieldsHelper.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Brian Teeman <brian@teeman.net>
Quy
reviewed
Oct 13, 2024
@@ -53,6 +53,8 @@ COM_FIELDS_FIELD_ONLY_USE_IN_SUBFORM_LABEL="Only Use In Subform" | |||
COM_FIELDS_FIELD_PLACEHOLDER_DESC="Placeholder text which will appear inside the field as a hint to the user for the required input." | |||
COM_FIELDS_FIELD_PLACEHOLDER_LABEL="Placeholder" | |||
COM_FIELDS_FIELD_PREFIX_LABEL="Prefix" | |||
COM_FIELDS_FIELD_PREPARE_CONTENT_DESC="Optionally prepare the content with Joomla Content Plugins." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
COM_FIELDS_FIELD_PREPARE_CONTENT_DESC="Optionally prepare the content with Joomla Content Plugins." | |
COM_FIELDS_FIELD_PREPARE_CONTENT_DESC="Use Joomla Content Plugins to prepare the content." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the extension development room someone asked, if content plugins replace custom fields values. The correct answer to the question is: It depends.
If you include a field with {fields x} then it can be be replaced, if the content plugins run in the right order. E.g. I made a text field and set it to {loadmoduleid 17}, if the content/field plugin runs before the content/loadmodules plugin then its gets replaced otherwise not.
If the fields is displayed with "Automatic Display" then it is never replaced.
This feels inconsistent.
I had the idea to add a prepare content parameter to the fields like we have this for a custom module. The we could control the replacement better. Opinions please?
Summary of Changes
I have added a new parameter "Prepare Content" to the custom fileds like we have it for a custom module. I made changes to the FieldsHelper and run content plugins when the parameter is set to yes. The default value for "Prepare Content" is no. This can have an effect to the site performance.
I am not sure if we should add this to the core so I will keep it as draft and let the maintainers make an decision.
Testing Instructions
Actual result BEFORE applying this Pull Request
or when the ordering of the content plugins is fields -> loadmodules
Expected result AFTER applying this Pull Request
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed