User tests: Successful: Unsuccessful:
$data in JModelForm::preprocessData need to be linked, otherwise any changes made by plugin on onContentPrepareData
have no effect when $data is array
test
add event onContentPrepareData
into the content plugin:
public function onContentPrepareData($context, &$data)
{
if ($context !== 'com_menus.item')
{
return true;
}
$data['title'] = 'My custom title';
}
Then go to menu manager and try make new menu item.
expected result
you get predefined title "My custom title"
actual result
nothing changed
After quick check Content, User, Banners, Categories: $data is JObject
- so there all good,
and in MenuItem: $data is array
- that where I got a problem
@Bakual sorry, I not very understand why need to changes something in other places as JModelForm::preprocessData
is the one place where event onContentPrepareData
actually called
Ah true, I didn't check the data type. If they're an object, then they're passed by reference anyway and thus it's fine indeed. Sorry for the confusion then. :)
Labels |
Added:
?
|
Category | ⇒ | Libraries Plugins |
Status | New | ⇒ | Pending |
Easy | No | ⇒ | Yes |
Milestone |
Added: |
Milestone |
Removed: |
Milestone |
Added: |
Sorry guys, but shouldn't this have a "Re-evaluate for v4.0" label more than a "Joomla 4.0" milestone?
The milestone is just a test for the referenced Issue in JIssues.
This one should be fine to be merged into 3.4.2 or 3.5.0. If it gets any tests at all.
Milestone |
Removed: |
Test it and works like described.
Milestone |
Added: |
I have tested this item successfully on 0188a81
Status | Pending | ⇒ | Ready to Commit |
I have tested this item successfully on 0188a81
Patch solves issue.
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-10-24 14:45:58 |
Closed_By | ⇒ | Kubik-Rubik |
Labels |
Removed:
?
|
Milestone |
Milestone |
Added: |
Milestone |
Added: |
Milestone |
The only plugin we have in core which uses that event is the user profile one. And the call for that is indeed by reference like suggested here.
I did a short search and found 6 other places where this call is made. So my request would be that you change them as well so it's consistent across all instances.