Categories


Archives


Recent Posts


Categories


Open Magento 2 Technical Questions: February 6, 2016

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

Welcome to your fortnightly “Open Magento 2 Technical Questions” post. If you’ve got an answer to any of the following please use the provided Stack Exchange thread to answer, or say hello via email if public communication isn’t possible.

First off, we’ve got a slew of new questions. After that, some follow up from last week’s open questions. There’s always more information in the linked Stack Exchange threads.

New Questions!

How does Theme Layout Handle XML File Merging Work

This one is partially answered, although I’d love to see a full breakdown of where Magento merges/sorts out the layout handle XML file loading.

Programmatically Triggering a 404, 500, 503, etc. error

Many PHP frameworks have globally available methods that will let a developer say

OK just stop this nonsense and return a 404, 500, 503 error

It’s not clear if this is possible in Magento, or if it’s a developer’s responsibility to handle this themselves in their controller execute methods.

Questions Answered from Last Week

Setting up a Magento 2 Admin Route

Magento’s core engineering team responded and let us know that Magento 1’s front name authentication problems should be a thing of the past, and that the preferred method of setting up an admin route for each module to have it’s own router ID and front name.

This answer did come from a lead architect, so it’s possible members of the rank and file may be inadvertently creating admin features that rely on a certain URL structure. Keep an eye out and remember to file issues as you find them.

RequireJS Integration

A member of Magento’s core engineering team responded to let us know that Magento’s using RequireJS’s baseUrl feature to set a base module URL, and that no URL transformation happens. If you’re curious how this works checkout the Magento 2 and RequireJS article.

URLs Must be Three Characters Long. Why?

Magento’s core engineering team responded and let us know the three character limit was one of those .0 oversights that was misapplied to route names. The implication is it will be removed in a future version.

Minimal Composer File

I ended up tackling this one myself. However, it has raised a second question about the mysterious type attribute in composer.json files, and what Magento is doing with this information.

How does Magento 2 Send Email

Community member Peter Jaap Blaakmeer tracked down a useful dependency injection code point where we’ll be able to slot in a mandril or SES implementation.

Questions Still Open from Last Time

Running setup:di:compile only for a single module

Magento’s engineering team responded, acknowledged this problem, but indicated it’s a complex one to solve. If I understood the reasoning, the problem is what happens when the single module has a dependency on another module that hasn’t been compiled. Marking this one as half answered, and hoping someone knows of a way to run the validations stand-alone

Role of the exclude tag in view.xml files

It’s still not clear what, exactly, the exclude tag excludes things from. Also related – the concept of bundling.

How to use ui_component

A tutorial on how to use the ui_component tag to create UI listing Grids and forms is sorely needed. As is a tutorial on how to create your own UI Components for reuse. The dev docs team has some interesting documentation on the feature, but like a lof of dev docs it seems oriented towards on-boarding Magento team members and marketing the platform, and not at teaching the community how to develop modules.

Reading Configuration Files in Magento

Still no information on the right way to read configuration files in Magento. Based on push back from the core engineering and documentation teams, my best guess here is they see it as their job to provide base configuration reading classes, but that writing the code to merge and read these files is the responsibility of individual module developers.

This is unfortunate, as it’s already led to different implementations in Magento core modules, and likely means third party module developers and consulting services organizations will end up with even more implementations. One of the things Magento 1 did right was provide consistant native PHP code for configuration reading.

The price of progress, I suppose.

Copyright © Alana Storm 1975 – 2023 All Rights Reserved

Originally Posted: 6th February 2016

email hidden; JavaScript is required