Magento 2 Tool Chain I’ve learned to accept, in my head, that this sort of over complication always happens when the size of the team maintaining an application or system grows. That said, I’ll never quite understand why in my heart.
astorm
A technical guide to the Magento 2 checkout A deep dive (written by Inviqa) on the javascript checkout application in Magento 2. A nice companion to my UI Components series — the Inviqa article has some application specific details that will be useful to any developer customizing the checkout flow. (hat tip to Joe Constant)
astorm
I came across this code recently while researching Magento 2’s UI Component system initComponent: function (node) { if (!node.component) { return this; } loadDeps(node) .then(loadSource) .done(initComponent); return this; } That block in the middle might confuse a junior programmer, but I’m no spring chicken. That looks like [...]
astorm
Magento 2 uiClass Imports and Exports Explained I’m working on my own version of this as we speak, but the Jessie Maxwell does a nice job of breaking down the imports and exports feature of Magento’s UI Components.
astorm
Magento 2: Approximating Local Code Pool Overrides Not sure if I like the idea of this becoming a common practice, but if you know your composer autoloading you can replace any class in Magento with a version of your own.
astorm
Another javascript debugging snippet for the intrepid Magento 2 javascript programmer. The Magento_Ui/js/core/app RequireJS module/application/program is an important part of Magento 2’s UI Component system. This is the program that registers KnockoutJS views and makes them available for use in the (custom to Magento 2) Knockout.js [...]
astorm
When I started work on pestle’s Magento 2 code generation, I deliberately left the the <preference/> feature of Magento’s di.xml files off the list of commands. This was, in short, to help encourage the use of plugins over preferences. i.e. to encourage developers to use the system that allowed multiple extensions to [...]
astorm
This one’s more interesting than it is useful (or its main use is as a debugging exercise), but while I was working on a UI Component tutorial I wanted to turn off the XSD validation for ui_component files. It turns out there’s a dedicated object that can control whether the XSD validations are applied [...]
astorm
For folks using pestle, my PHP command line frameworking + Magento code generation tool, I’ve just added a selfupdate command. This will make a backup of your current version, grab the latest version, and update your local copy (permissions allowing, of course) $ pestle.phar selfupdate Downloaded to /private/tmp/pestle_DZOXou [...]
astorm
I’m knee deep in a rewrite of No Frills Magento Layout for Magento 2 – I know the systems well enough to use them, but I’m still coming up to speed on the underlying object implementations. This is important, since my approach in No Frills is Here’s how you’d do this in PHP, here’s how to do the same [...]
astorm
Although the technique still works, various members of Magento’s engineering team have discouraged using Magento 1’s <action method="..."/> syntax to call methods on blocks from layout update XML files. <block ...> <action method="addTab"> <argument name="name" [...]
astorm
Magento 2 module creator and code generator | Mage2Gen Haven’t had a chance to check this out yet, but it looks like another Magento 2 module generation tool. This one seems to be an “everything and the kitchen sink” approach (vs. pestle which lets you build only the parts you need) but that approach does mean you get a [...]
astorm
Can’t Add a new UI Component Type · Issue #5647 · magento/magento2 An interesting side effect of the new XML schemas – the definition.xml files for UI components have their top nodes locked down, which means developers can’t add their own UI component types.
astorm
Formatting Dates in Magento Javascript If you’re doing any work in Magento’s RequireJS based javascript modules and see a dateFormat string defaults: { dateFormat: 'MMM d, YYYY h:mm:ss A' }, Chances are its a Moment.js date format string. You can pull in the main moment function via a RequireJS shim define(['moment'], [...]
astorm
I’ve been digging through Magento’s UI Components this week and hit a stumbling block. The main KnockoutJS template that kicks off rendering (vendor/magento//module-ui/view/base/web/templates/collection.html) looks like this <each args="data: elems, as: 'element'"><render [...]
astorm
I just updated pestle with a new magento2:generate:ui:grid command. Magento 2.1+ only, not likely to be ported backwards to the 2.0.x branch. A longer article over on alanstorm.com is forthcoming, but here’s the quickie version. Here’s the arguments to use to create a UI Component Listing. $ pestle.phar [...]
astorm
If you’re following along with Magento 2 development, you’ve probably heard the drum beat that the Model/Resource Model/Collections are old and tired, and the Repository classes are new and wired. While the move towards repositories is is a Good Thing™, a Magento 2 developers still needs to know the old CRUD system, and that [...]
astorm
How Interceptors are Generated TLDR; The object manager appends Interceptor to the class name you asked for if there’s a plugin. Then a second PHP Autoloader will look for Interceptor at the end of a classes name, and if it can’t find a definition via normal means, the autoloader generates the class.
astorm
One of the things Magento 2.1 doesn’t bring to the table is the ability to symlink your modules and other components. It’s hard to tell if this is a deliberate omission, or just something that’s not a priority for the development team and keeps getting lost in the shuffle. If you checkout the Context section of this [...]
astorm
This is another one of those 10,000 foot view posts, as much to get my own head straight about something as anything else. In programming, the term scope usually means If I’ve defined variable X “here”, where else can I access it? Magento’s core team have borrowed the term scope to described Magento’s [...]
astorm