Giter VIP home page Giter VIP logo

magento2-ho_templatehints's Introduction

H&O Magento 2 Advanced Template Hints module

Overview

Ho_Templatehints extends the default Magento template hints.

  • Easily accessible with muscle memory ?ath=1.
  • Shows hints for Templates, AbstractBlocks (Blocks), Containers and UI Components.
  • No layout interference: Using css outline instead of borders of other HTML elements, so it doesn't f'up the layout.

Usage $0

Installation

composer require --dev honl/magento2-templatehints
php bin/magento module:enable Ho_Templatehints
php bin/magento setup:upgrade

Development installation (git enabled)

composer require --dev honl/magento2-templatehints "dev-master"
php bin/magento module:enable Ho_Templatehints
php bin/magento setup:upgrade

Configure PHPStorm, allow remote calls

Setting up PHPStorm

Usage

  1. Set your Magento 2 installation to developer mode (when in production mode make sure to add your IP address in Developer Client Restrictions).
  2. Add ?ath=1 to your URL to activate.
  3. Open up your console in you Chrome/Firefox/Safari/IE devtools.
  4. hold (shift)
  5. Hover over the element you wish to inspect
  6. Voila! Hints everywhere!

Hints for hidden elements

You can't show hints for a hidden element, for that purpose there is hint($0):

//Select an element in the Elements panel in your devtools, it is now available with $0
hint($0)

Console $0

Inner Workings

The module adds an additional HTML attribute to the outer most element of a layout element.

Credits

Inspiration from Aoe_TemplateHints and a lot of love from H&O.

Developer

This module was developed by the H&O team. Check out more about this module on the H&O website: H&O Magento 2 Advanced Template hints module

magento2-ho_templatehints's People

Contributors

amenk avatar cedriquegeense avatar danielruf avatar frankharland avatar hgati avatar jahvi avatar paales avatar pascalbrouwers avatar pierzakp avatar pihtt avatar quentenz avatar tthierryera avatar vinai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magento2-ho_templatehints's Issues

PHP requirements don't match Magento 2.4.4

Preconditions

  1. Magento 2.4.4

Steps to reproduce

  1. Run composer require-commerce --dev honl/magento2-templatehints

Expected result

  1. No error is thrown
  2. The module is installed

Actual result

  1. The following error is thrown because of PHP ~ 7.1 in the composer.json requirements while Magento 2.4.4 requires PHP >= 8.1:
Package honl/magento2-templatehints has requirements incompatible with your PHP version, PHP extensions and Composer version:  
    - honl/magento2-templatehints 0.2.5 requires php ~7.1 which does not match your installed version 8.1.1.

Other js events prevent output in console

I have a magento 2.2.6 installation.
Shift clicking on a product image opens up the light box view of the product image, not logging any output to the console.

The same seems to be true for buttons having click events.

Not working in search page

adding ?ath=1 to the url does not work on search result page ( I guess on advanced as well but did not try) and the hints are not present with the page loading normally

There is a solution to this?

Wrong URL in the remote call (Docker)

When running in docker, the project is mapped to different folders.
It woul be nice to be able to define the root magento path.

Example:
In my case, the remote call points to http://localhost:63342/api/file//var/www/html/vendor/magento/module-sales/view/adminhtml/templates/order/view/info.phtml
The correct one would be http://localhost:63342/api/file/src/vendor/magento/module-sales/view/adminhtml/templates/order/view/info.phtml

Note there's no extra / and the paths are different in the project.
It's impossible to predict, but making it configurable would help.

PS: Congratulations for the amazing work with the module. It helps a lot.

Problem with HTML parsing

We have the following HTML

<!--Authentication Pop-Up-->
</div></header><div x-data="initHeaderNavigation()"
 x-init="$watch('activeSubmenuId', value => activateSubmenuMobile(value))"

The module inserts the hint like this

<!--Authentication Pop-Up-->
</div></header><div x-data="initHeaderNavigation()"
 x-init="$watch('activeSubmenuId', value = data-ho-hinttype="block" ....
 @menu-back.window="back"
 class="relative z-50 font-bold bg-gray-200 lg:block lg:z-40"

Reason: We should not parse HTML with regex https://github.com/ho-nl/magento2-Ho_Templatehints/blob/master/Plugin/View/LayoutPlugin.php#L117

Related to Hyvä, because we use Alpine JS there and these notations are common

https://gitlab.hyva.io/hyva-themes/hyva-compat/magento2-ho-templatehints/-/issues/2

Show server side info (PHP block and template) also on knockout view model scoped elements.

When I inspect for example the compare products block in the sidebar, the KO view model is logged to the console, but I get no information on the underlying PHP block and template that was used, which was the information I was actually after.

I didn't find a way to access that info.

It would be cool if it would be printed or if there where some way to get at the "server side" info for everything.

Thanks!

Syntax Error

I get the folowing error after installation via Composer.

Parse error: syntax error, unexpected '?' in /magento/vendor/honl/magento2-templatehints/Plugin/View/LayoutPlugin.php on line 150

I followed the steps in the readme

No compatibility with php 5.6

My php version is:
PHP 5.6.31-4+ubuntu16.04.1+deb.sury.org+4 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

The error is:

[Tue Nov 21 15:26:21.413890 2017] [:error] [pid 6916] [client 192.168.1.97:40862] PHP Parse error: syntax error, unexpected '?' in .../app/code/Ho/Templatehints/Plugin/View/LayoutPlugin.php on line 150

New Release

Please create a new release :-)

Thanks a bunch!

php 8.2 not support?

composer install error with php 8.2

 Package honl/magento2-templatehints has requirements incompatible with your PHP version, PHP extensions and Composer version:
    - honl/magento2-templatehints 0.3.0 requires php ~7.4||~8.1.0 which does not match your installed version 8.2.2.

Setting for disabling the ?ath=1 parameter

Just a minor feature request which would make the workflow of frontend developers a bit faster and easier.

I've recently been doing frontend development and Jisse from @yireo recommended this module to me, but every time I want to inspect blocks I have to add the URL parameter to do so, wouldn't it be nicer if there was a setting for enabling/disabling the URL parameter so you can inspect elements right away if the developer wishes to?

I can supply you with the code if this idea sounds good to you!

Add support for a "ath"-cookie to enable template hints

Please add support for enabling the template hints using a cookie. Compared to the url parameter a cookie is automatically added to every page request.
When debugging Magento I frequently have to debug dynamic pages, that might change when being run a second time. Using a cookie works for a links on the website and no changes to the urls are required.

Not working in checkout success

You can't use the extension on the checkout success page. If you add the parameter ?ath=1 to the checkout then it gets automatically removed in checkout success.

not working

I've just installed the extension to composer, I see it in the enabled modules but when I push shift with the console opened nothing happens.

I'm using Magento 2.2.5, is there maybe a bug on this version?

Should allow PHP 8.2

Magento 2.4.6 now supports PHP 8.2 so should allow the module to use with PHP 8.2

Bug/Idea suggestion

Opening in PhpStorm simply doesn't work anymore, regardless the configuration allowing unsigned requests when using docker.

It's just because the FILE is different then the file in my local machine.
For example: http://localhost:63342/api/file//var/www/html/vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml

The correct url would be http://localhost:63342/api/file/src/vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml

Adding some option to map or replace the url properly would be very nice.

Error during compile

Run

php magento setup:di:compile

During the step - Interceptors cache generation...
return Error:

Ho\Templatehints\Block\Hints\Init
        Incorrect dependency in class Ho\Templatehints\Block\Hints\Init in /Applications/XAMPP/xamppfiles/htdocs/magento2data/vendor/ho-nl/magento2-templatehints/Block/Hints/Init.php
\Magento\Framework\View\Asset\Repository already exists in context object
Total Errors Count: 1
Errors during compilation:
    Ho\Templatehints\Block\Hints\Init
        Incorrect dependency in class Ho\Templatehints\Block\Hints\Init in /Applications/XAMPP/xamppfiles/htdocs/magento2data/vendor/ho-nl/magento2-templatehints/Block/Hints/Init.php
\Magento\Framework\View\Asset\Repository already exists in context object
Total Errors Count: 1
Errors during compilation:
    Ho\Templatehints\Block\Hints\Init
        Incorrect dependency in class Ho\Templatehints\Block\Hints\Init in /Applications/XAMPP/xamppfiles/htdocs/magento2data/vendor/ho-nl/magento2-templatehints/Block/Hints/Init.php
\Magento\Framework\View\Asset\Repository already exists in context object
Total Errors Count: 1

work with production mode

I'm not sure if it is possible technically but it would be great if we can run this with production mode

PHP version support

I think in README, we should state which version the module were tested with. But in composer we should allow any PHP version which likely working with instead of fixing specific versions because our module keep out of dated than PHP version update.

For now, please update composer to support any PHP 7.2.x

Installation not successfull

I get

Error: Cannot instantiate abstract class Magento\Framework\Model\ResourceModel\AbstractResource in /var/www/hausfux/m2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php

You also need to execute php bin/magento setup:di:compile

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.