Conversation
In certain circumstances (see below) the module title is rendered multiple times.
|
This closes the seventh oldest bug report from 2016 and annoyingly the fix has been here on github for 6 months but no one answered. |
|
I have tested this item ✅ successfully on a7c2191 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38571. |
|
I have tested this item ✅ successfully on a7c2191 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38571. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38571. |
1 similar comment
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38571. |
|
@bembelimen who can check the drone errors? The seems to be not related? |
| foreach (explode(' ', $attribs['style']) as $style) { | ||
| if ($moduleContent = LayoutHelper::render('chromes.' . $style, $displayData, $basePath)) { | ||
| $module->content = $moduleContent; | ||
| $module = $moduleContent; |
There was a problem hiding this comment.
You should not override $module variable, it will break much more here.
Example: later on $app->triggerEvent('onAfterRenderModule', array(&$module, &$attribs)); will triggered with incorrect $module value.
There was a problem hiding this comment.
Possibly that’s the reason why api tests are failing, but that’s only a gut feeling.
|
As a quick fix, I would suggest just clone a module, before this code: joomla-cms/libraries/src/Helper/ModuleHelper.php Lines 211 to 215 in dd91072 $module = clone $module;
$displayData = array(
'module' => $module,
'params' => $params,
'attribs' => $attribs,
);With comment why it is cloned.
joomla-cms/libraries/src/Helper/ModuleHelper.php Lines 246 to 250 in dd91072 upd: forget about cache, it have other drawbacks for "chrome" |
|
Happy for you to submit a pr to my branch. Would be good to fix this very old bug |
|
I made alternative one #38582 please test |
|
Closed in favour of #38582 |
In certain circumstances (see below) the module title is rendered multiple times.
Pull Request for Issue #37147 and #12888
Testing Instructions
Create a custom module and set the style to "card" and publish on all pages
Create an article and load the module inside the article using {loadmodule}
Check the frontend on any page thaat will display both the article and the module
Actual result BEFORE applying this Pull Request
Expected result AFTER applying this Pull Request