加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

magento2如何知道当前页面加载了那些layout xml file?

发布时间:2020-12-16 08:23:24 所属栏目:百科 来源:网络整理
导读:需要修改core代码,位置: vendor/magento/framework/View/Model/Layout/Merge.php: _loadFileLayoutUpdatesXml 添加file_put_contents代码行 foreach ($updateFiles as $file) { // ... file_put_contents(BP . '/var/log/layout_files.csv',$tagName.','.$h

需要修改core代码,位置:vendor/magento/framework/View/Model/Layout/Merge.php: _loadFileLayoutUpdatesXml

添加file_put_contents代码行

foreach ($updateFiles as $file) {
    // ...
    file_put_contents(BP . '/var/log/layout_files.csv',$tagName.','.$handleName.','.$file->getFilename()."rn",FILE_APPEND);
}

清除缓存后访问页面,得到数据 var/log/layout_files.csv

每个页面都有handle,例如catalog_product_view代表product detail page,在layout_files.csv查询catalog_product_view,就能知道该页面加载的所有layout xml的位置。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读