The auto_use ['views'] should be Disabled at a Global Level

Issue #36 resolved
Alan Storm created an issue

I was experimenting with template replacement in Sellvana, and I think the current behavior w/r/t a global auto_use: [ views ] should be changed.

If a user enables auto_use: [ views ] at the global level, and uses it to replace a template in one area, the effects will spill over into all areas. While from a purely programatic point of view this is the "correct" behavior, based on experience with areas in Magento this seems likely to cause a lot of confusion (I was in the middle of reporting an "my admin is busted" bug until I realized what I'd done)

Given the potential for a frontend developer working on the frontend to potentially break a template required in the backend, and my not being able to think of reasons you'd want this functionality, using auto_use: [ views ] at the global, not area specific level, should be disabled.

Reproduction Steps

  1. Create a module with the manifest listed below (also, extension attached)

  2. Notice the global level auto_use

  3. Enable your new module with a run level of REQUIRED

  4. Copy the core/FCom/Frontend/Frontend/views/root.html.twig template to core/local/Pulsestorm/Helloworld/views/root.html.twig

  5. Alter core/local/Pulsestorm/Helloworld/views/root.html.twig to include the text <h1>I am changing a frontend template</h1>

  6. Browse to a frontend page, ensure your <h1>I am changing a frontend template</h1> text shows up

  7. Login to the admin

Expected Behavior: Backend displays are per normal

Actual Behavior: Backend page also displays the <h1>I am changing a frontend template</h1> text

modules:
    Pulsestorm_Helloworld:
        version: 0.0.1
        channel: beta
        require: { module: { FCom_Frontend : 0.1.0 } }
        description: "Module Description Here"    
        auto_use: [ views ]

Comments (3)

  1. Boris Gurvich

    The issue you're describing is not because of global auto_use: [ views ] configuration. Even if this configuration would be confined to areas only, it would still attempt to load the global module views folder. This was made for views that can be used in all areas, such as email templates. Also, FCom_Feedback module uses the same template for both Admin and Frontend.

    I think it just should be reinforced in designer guide to use Frontend folder for all theme files.

  2. Log in to comment