onContentPrepare fix #111
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#111
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I would like to add onContentPrepare to each text area and text field loaded in a site view, there is already some code that does this
on line 1514 in the Interpretation.php
But it seems to stop working, so now I would like to redo it like the way the article component implements this.
on line 187 in the view.html.php file of the article view.
Any ideas will be helpful!
I do a lot of work with plugins.
The first option in the config array becomes the $context variable in plugin. This allows the plugin author to selectively apply their changes to only items that match a context. Normally, you'd set the valid component and view dot path and let the cards fall where they may - that is, if a plugin has a narrow $context - it might not show the plugin alterations. For context though, you can go any direction you want - broad, narrow - I saw one extension that used com_component.view.layout in its plugin context...
So, in order to do this the right way, the component name and view name must be available when this code is generated (as opposed to faking another context, which I've also seen developers do). Passing the item by reference allows the plugin to make changes - otherwise the plugin can look, but not touch. I'd pass the item params as well, although the plugin would have to know what it was looking for to use them.
I've issued a PR, it should be linked by now
Right, there is something that isn't working right - apparently ###view### isn't available at this point in e_Interpretation.php - so the closest context I can get is com_###component###
I'm adding some additional code to create a better $context based on the available fileContentStatic keys. So if you want to modify the code to include the view name, it will happen in this code automatically.
Nevermind about the context, I have it. Removing the additional logic to construct a context - I can get it from the model.