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:
if (isset($items) && $items)
{
foreach ($items as $nr => &$item)
{
//build people slug
$item->people_link = JRoute::_([[[Component]]]HelperRoute::getPeopleBioRoute($item->slug));
}
}
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:
Too few arguments to function plgContentJdForm::onContentPrepare(), 3 passed in /.../httpdocs/libraries/joomla/event/event.php on line 70 and exactly 4 expected
System information (as much as possible)
OS Name & Version: x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18), 64-bit
MySql Version: 5.5.56
Apache Version:
PHP Version: 7.1.14
Joomla Version: 3.8.5
JCB Version: 2.6.17
Browser: Chrome
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:
$_people_education = new stdClass();
$_people_education->text =& $data->people_education; // value must be in text
// Since all values are now in text (Joomla Limitation), we also add the field name (people_education) to context
$this->_dispatcher->trigger("onContentPrepare",array('com_cmd_systems.peoplebio.people_education',&$_people_education,&$this->params));
### 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:
```
if (isset($items) && $items)
{
foreach ($items as $nr => &$item)
{
//build people slug
$item->people_link = JRoute::_([[[Component]]]HelperRoute::getPeopleBioRoute($item->slug));
}
}
```
### 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:
> Too few arguments to function plgContentJdForm::onContentPrepare(), 3 passed in /.../httpdocs/libraries/joomla/event/event.php on line 70 and exactly 4 expected
### System information (as much as possible)
- OS Name & Version: x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18), 64-bit
- MySql Version: 5.5.56
- Apache Version:
- PHP Version: 7.1.14
- Joomla Version: 3.8.5
- JCB Version: 2.6.17
- Browser: Chrome
### 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:
```
$_people_education = new stdClass();
$_people_education->text =& $data->people_education; // value must be in text
// Since all values are now in text (Joomla Limitation), we also add the field name (people_education) to context
$this->_dispatcher->trigger("onContentPrepare",array('com_cmd_systems.peoplebio.people_education',&$_people_education,&$this->params));
```
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
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.
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
public function onContentPrepare($context, &$article, &$params, $limitstart)
The error message I recieve is:
0 - Too few arguments to function plgContentAllWeblinks::onContentPrepare(), 3 passed in
/.../httpdocs/libraries/joomla/event/event.php on line 70 and exactly 4 expected
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.
I have seen this issue which was evident with one plugin which was loading
```
public function onContentPrepare($context, &$article, &$params, $limitstart)
```
The error message I recieve is:
```
0 - Too few arguments to function plgContentAllWeblinks::onContentPrepare(), 3 passed in
/.../httpdocs/libraries/joomla/event/event.php on line 70 and exactly 4 expected
```
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.
This issue is JCB does not use that filter in its populateState, and secondly it is irrelevant to the text/value it self.
So what value should we pass?
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
```
$offset = $this->state->get('list.offset');
```
And then
```
$dispatcher->trigger('onContentPrepare', array ('com_content.article', &$item, &$item->params, $offset));
```
This offset seems to be the:
```
$offset = $app->input->getUInt('limitstart');
```
Inside the populateState of the module.
> This issue is JCB does not use that filter in its populateState, and secondly it is irrelevant to the text/value it self.
So what value should we pass?
On the model I added
```
, $page = 0
```
Which allows the page to show correctly, on a search of the Joomla repository the options in use are as above or
```
, 0
```
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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