-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
\Magento\Framework\View\Model\Layout\Merge stores the theme at construct time #30656
Comments
Hi @ericmorand. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
I confirm that a plugin solves the issue: <?php
namespace {Vendor}\{Module}\Plugin\Framework\View\Model\Layout;
use Magento\Framework\View\DesignInterface;
class Merge
{
/** @var DesignInterface */
protected $_design;
public function __construct(DesignInterface $design)
{
$this->_design = $design;
}
public function afterGetTheme(\Magento\Framework\View\Model\Layout\Merge $subject) {
return $this->_design->getDesignTheme();
}
} |
Hi |
It is also responsible to load handle updates stored in database - for example widgets set in the back office, through this function: public function getDbUpdateString($handle)
{
return null;
} This function is intercepted by a plugin ( The issue here is that at that point, the theme has already been loaded by the You end up with the following situation:
It is expected since when It's what my plugin above fixes. But it should be fixed in the core code base. |
Widget dynamic type such as (list, link..) only visible after clean cache. If after setup widget we don't clear cache widget will never show. Widget type block will show without need clean cache |
Hi @engcom-Delta. Thank you for working on this issue.
|
Maybe we should target on widget plugin ? Obviously that widget should get current theme instead singleton instance |
Hi @ericmorand thank you for your report. Could you clarify how you set specific theme for the Product ? |
@engcom-Delta Have you check the test case specific product set for schedule update theme luma and widget set for all product display at blank theme for example.? Expected result widget should not visible when we visit product |
This issue may can reproducible in latest codebase |
Reproducible case with luma theme setup with default sampledata Pre-config Product named "Joust Duffle Bag" Actual Expected |
Seem issue fixed in this commit 76ff97e#diff-d036d544db88cf91738bb3b56dbe89e156d4043e4cb7062af1eda9d20911d672R196 (lastest recently merged 2.4-develop) |
Hi @engcom-Echo. Thank you for working on this issue.
|
Hi @engcom-Echo can you help re-verify this case ? |
based on update from 2.4-develop as i mentioned previously above message |
#30656 (comment) |
Preconditions (*)
Magento 2.3.5
Steps to reproduce (*)
Expected result (*)
The specific theme is used and the widget is displayed.
Actual result (*)
The specific theme is used but the widget is not displayed.
Explanation
\Magento\Framework\View\Model\Layout\Merge
stores the theme at construct time.This creates a major issue with the rendering process, when one of the actor wants to change the theme - like for example the Magento_Catalog module. Since the theme is stored at construct time, would it be changed later, the
Merge
instance would always use the former theme stored at construct time to fetch layout updates.The most spectacuar issues it creates is when trying to assign widgets for catalog layout handles (like catalog_product_view). Since the
Merge
instance always uses the default theme to fetch the layout updates, it never gets the chance to fetch the ones that are assigned to the widget if the theme of the product is not set to the default theme of the website. The only way for the widget to get grabbed is for it to be assigned to the default theme of the website, whatever the custom theme applied to the products.Fortunately it should be easy to write a plugin that intercepts
getTheme
from theMerge
instance to return the current theme instead of the one set at construct time.Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
The text was updated successfully, but these errors were encountered: