Skip to content
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

Topmenu template is not loaded from the original module #4564

Closed
digitalpianism opened this issue May 19, 2016 · 2 comments
Closed

Topmenu template is not loaded from the original module #4564

digitalpianism opened this issue May 19, 2016 · 2 comments
Labels
Area: Frontend bug report Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed

Comments

@digitalpianism
Copy link
Contributor

digitalpianism commented May 19, 2016

Steps to reproduce

  1. Install Magento from 2.0 branch.
  2. Create a module with a preference for the Magento\Theme\Block\Html\Topmenu

<preference for="Magento\Theme\Block\Html\Topmenu" type="MyCompany\Theme\Block\Html\Topmenu" />

  1. Create your custom class:
<?php

namespace MyCompany\Theme\Block\Html;

class Topmenu extends \Magento\Theme\Block\Html\Topmenu
{
    protected function _addSubMenu($child, $childLevel, $childrenWrapClass, $limit)
    {
        // my stuff
    }
}
  1. Reload your page.

Expected result

  1. Custom class is used
  2. No error

Actual result

  1. Custom class is used
  2. An error is triggered:

main.CRITICAL: Invalid template file: 'html/topmenu.phtml' in module: 'MyCompany_Theme' block's name: 'catalog.topnav' [] []

Cause

The template of this block is not prefixed with the module name: https://github.com/magento/magento2/blob/develop/app/code/Magento/Theme/view/frontend/layout/default.xml#L69

Instead of :

<block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600" before="-"/>

It should be:

<block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="Magento_Theme::html/topmenu.phtml" ttl="3600" before="-"/>

Could you please confirm that is a bug so I can make a PR to fix that.

The bug was discovered in this Magento SE post: http://magento.stackexchange.com/questions/115988/are-we-forced-to-rewrite-a-template-in-magento2-when-rewritting-a-block

@digitalpianism
Copy link
Contributor Author

Thanks to @fooman here's a PR that is fixing the issue: https://github.com/magento/magento2/pull/1895/files

@wert2all wert2all self-assigned this Jun 23, 2016
@wert2all wert2all removed their assignment Jun 23, 2016
@magento-engcom-team magento-engcom-team added bug report Area: Frontend Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Sep 11, 2017
@magento-engcom-team
Copy link
Contributor

Closing, as issue seems to be fixed.

magento-engcom-team pushed a commit that referenced this issue Aug 1, 2019
[Owls] TinyMCE Issues within inline WYSIWYG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend bug report Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed
Projects
None yet
Development

No branches or pull requests

4 participants