Only 3 parameters provided for onContentPrepare in Dynamic Get/SiteView #237
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#237
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?
Steps to reproduce the issue
Created Admin views, Dynamic Gets and Site Views to display a list (getListQuery) that links to the individual getItem-related Site View.
Link within the getListQuery (Add PHP after getting the items) is this:
Expected result
Links display the individual site view page (based on the getItem dynamic get).
Actual result
When clicking on the link get error message:
System information (as much as possible)
Additional comments
In the components/com_COMPONENT/models/peoplebio.php file, in the "Load the JEvent Dispatcher" area there are 3 fields of the type EDITOR that each have lines similar to this:
According to the Joomla docs for onContentPrepare (https://docs.joomla.org/Plugin/Events/Content#onContentPrepare) this method is expecting 4 parameters, yet only 3 are being generated by JCB.
I was able to just use custom code tags to override this area and add a 4th parameter - I just added 1 and it worked fine (although the individual display is just 1 page, so not sure what would happen if it were more).
NOTE: In doing another test, in a WAMP installation, the system functions perfectly fine with only 3 parameters provided.
The initial dev site and test sites are on LAMP instead of WAMP. The LAMP sites were older sites (3.7.x ish) that have been upgraded. The WAMP site was a clean install of J3.8.5.
WAMP Server Details
OS Name & Version: Windows NT DESKTOP-PASCHEN 10.0 build 16299 (Windows 10) AMD64
MySql Version: 5.7.19
Apache Version: 2.4.27
PHP Version: 7.1.19
Joomla Version: 3.8.5
JCB Version: 2.6.17
Browser: Chrome
Not sure that this is really a 'problem' for JCB or if there is either some 'legacy' issue on the initial site, or a conflict with something else; however, considering the specs (at least the version posted) require 4 parameters for onContentPrepare, it would make sense if 4 were provided.
I have seen this issue which was evident with one plugin which was loading
The error message I recieve is:
My work around at the moment is to disable the plugin making the call.
Is it safe to presume if there is one function calling all 4 parameters then all of them will need to call all 4?
If JCB isn't generating all 4 parameters I would suspect that it should be doing so.
Okay so what should this forth parameter be? I mean yes I see it says page, but what value in the module can be this?
I see in the article view.html.php it uses
And then
This offset seems to be the:
Inside the populateState of the module.
So what value should we pass?
On the model I added
Which allows the page to show correctly, on a search of the Joomla repository the options in use are as above or
Defaulting it to 0 would make sense when there isnt a 4th parameter to be set.
https://github.com/joomla/joomla-cms/search?p=1&q=onContentPrepare&type=&utf8=%E2%9C%93
Please test the latest push to staging branch and let me know if this resolves the issue.
Just pulled staging and tested here and it works as expected. Many thanks