Comments (6)
Not the best idea because template may be used by several blocks.
If you want to determine which template is related to some block class you may "Template Path Hits" (http://www.magentocommerce.com/blog/template-path-hints-tutorial-video/).
from magento2.
Most templates are used by only one block. I have requested this because I'd like to be able to ctrl click function calls like $this->doSomething()
in templates in my IDE.
from magento2.
Anyway idea is bad. Just think, what will happen if somebody rewrites this block using Magento rewrite system?
from magento2.
@FiveDigital
Thank you for proposing an interesting improvement.
Indeed, if to search among all PHTML templates in the system, notations @var $this
and @see
are already used ~50/50.
It does make sense to standardize block class(es) hinting. Proposal of declaring a primary block class using @var $this Primary_Block_Class
and optionally additional classes using @see Additional_Block_Class
has been sent to the technical leads for examination. As soon as there are any updates to the proposal state (rejected, accepted, adopted), corresponding update will be posted to the GutHub ticket.
@stalniy
Yes, you're right, that relation between blocks and templates is not 1 to 1, multiple blocks can utilize the same template. However, it does not contradict to the hinting of a primary and additional block classes.
from magento2.
I know that @see
is used in many templates, but that doesn't enable code completion/code hinting. I'm really a fan of being able to ctrl-click functions and I'm using this in templates, too. When we create/override templates for shop we develop in our company, I assure everyone add a @var $this
comment. In fact, I'm always adding comments like /* @var $products Mage_Catalog_Model_Resource_Product_Collection
everytime when writing code like $products = Mage::getResourceModel('catalog/product_collection')
to be able to auto complete function and jump easily in the core code.
from magento2.
The proposal was approved by the technical leads and included into Magento 2 coding standards. @var $this Primary_Block_Class
is intended for primary class definition and @see Additional_Block_Class
for additional classes. The task about updating exisitng templates was added to Magento 2 backlog.
@FiveDigital , thank you for the proposal.
from magento2.
Related Issues (20)
- About deleting license copyright comments in .html files HOT 1
- CSS minifiying sometimes results in blank CSS file due to PREG_JIT_STACK_LIMIT_ERROR in tubalmartin/cssmin HOT 8
- Animated gif not working HOT 23
- Missing indexing of required columns in catalog_product_entity_int table HOT 3
- Set Generate "category/product" URL Rewrites to "no" has no effect HOT 13
- Coupon usage limits not honored HOT 7
- Sales order item table, qty_backordered not set for configurable products HOT 2
- Currency not convert in new product widget without cache clean HOT 26
- Getting Database CPU usages high (100%) suddenlly HOT 6
- Configurbale Product update child product saving qty move issue HOT 24
- Cannot make city field optional in addresses HOT 6
- Columns functionality for \Magento\Theme\Block\Html\Topmenu seems broken HOT 6
- Export Product does not working with Large number of attribute HOT 12
- We are not getting the product_type and parent_item_id inside refund HOT 15
- magento 2 Braintree error verifyCard options must include a BIN. HOT 3
- We are not getting the base_grand_total value in order response HOT 13
- Customer address form allows random code in the name fields HOT 20
- Magento/OfflineShipping/Model/Carrier/Tablerate.php::collectRates is modifying the request for subsequent carriers HOT 8
- [Magento2]- Some amount (in decimal) is missing from total amount of the downloaded order . HOT 9
- Report viewed products does not seem to work correctly HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magento2.