Giter VIP home page Giter VIP logo

module-templatehints's Introduction

Magento 2 - Layout Hints (Enhanced)

Gitter

Why?

Let's be honest, the default Magento 2 layout hints are very bare (to stay polite). They lack much of the information that is needed when we want to debug the layout.

This module made my like easier when it comes to altering the layout and templates of Magento 2 and I hope it will do the same for you.

The goal is to show all blocks, containers and uiComponents on the page without breaking the page too badly. When the mouse hovers any given element it will show more information for the current hovered element and its parents. The data that is provided includes the name, alias, parent, template and class.

I've also added some nice frontend features to easily hide or show the hints that way it's easy to navigate the site while the hints are ON. There are some additional features that bring some of the CLI actions to the frontend such as enabling and disabling the hints from the frontend as well as clearing the caches directly from the browser.

This module will never make itself visible or have any effect in production mode, it will only work in developer mode.

Features

  • Enable and disable from Frontend, CLI or Admin panel
  • Shows blocks and containers
  • Displays the name and alias of the block or container.
  • Lots of information on hover such as the block class and template file.
  • Clear all caches from the frontend
  • Non-intrusive display
  • Layout information at the bottom of the page.

Install

composer require justinkase/module-layouthints
magento setup:upgrade
magento cache:flush

How to use this module

Frontend

Make sure you're in developer mode

Visit your Magento 2 store in a browser and use the following keys combinations.

Shortcuts:

  • Shift + Ctrl + H => Toggle hints visibility
  • Shift + Ctrl + = => Turn ON hints (you must also clear caches)
  • Shift + Ctrl + - => Turn OFF hints (you must also clear caches)
  • Shift + Ctrl + C => Clear caches

You might get a request to approve browser notifications.

Make sure you're focused on the page, click somewhere on the page with the mouse, but not a link!

CLI

justinkase:hints:on
justinkase:hints:off
magento cache:flush

Admin Panel

Stores > Configuration > Advanced > Developer > JustinKase - Layout Hints

Author

Alex Ghiban

module-templatehints's People

Contributors

drew7721 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

gitter-badger

module-templatehints's Issues

Add layout update hande information.

Many blocks are added, moved and changed in multiple layout update handles.
It would be nice to know the one that actually rendered the template.

For instance, there are many catalog_product_view layout handles that get merged together to create the layout. I wonder if there is a way to know which one had the last word on the block. This might not be possible so it needs to be investigated.

It would, however, be nice to know at least that it was the catalog_product_veiw handle that generated the block. Especially if the block comes from a custom layout update handle.

Enhanced way of getting information about the block.

Add a way of displaying more data information about the block.
Don't want the interface to be too polluted, so it would be nice that a Shift + click or a Shift + hover would display additional information about the current block.

This would be a js enhancement.

The block is shown twice.

The block element has double wrapping. Once from the block rendering and once from the element rendering. The element should only show the containers.

Add block group details.

It would be nice to know if the block belongs to a group or not.

<block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="Magento_Catalog::product/view/attributes.phtml" group="detailed_info">

group="detailed_info"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.