Category: Programming Quickies
Back in they day, I ran a Tumblr blog named Magento Quickies where I’d post shorter, less in-depth posts about my travels through Magento’s source code. This Programming Quickies categories is the successor to that Tumblr blog. You’ll find all the old Magento Quickies content here, as well as new short posts about programming in general.
This section has its own RSS feed, the old Magento Quickies feed should should be redirecting, and we’re cross posting notifications for new posts over to magento-quickies.tumblr.com. In other words, you shouldn’t need to know any of this, but the duct tape that keeps the internet held together isn’t aging well, so your mileage may vary.
Below you'll find all the Programming Quickies articles on the site,
followed by a chronological listing of the same.
You may also browse the
7
series directly via the following links.
Pestle, Four Steps to Async Iterators, Checking in on OpenMage and Magento in 2020, Text Encoding and Unicode, Shopware's Development Environment, A Sentimental Gen-X Programmer Culls his Tech Books, and, Containers, Containers, Containers.
Magento CE 2.1.3 database diagram – Anna Völkl Community Stalwart @rescueann just released the Magento 2 follow-up to her popular Magento 1 database diagram post. Beyond the super useful utility of having something like this pre-generated, Ann’s also spent a significant amount of time grouping related tables together. Even [...]
astorm
Documentation and Code Quality As the above StackExchange answer attests to, I finally know what the Magento_Ui/js/lib/knockout/extender/bound-nodes registry is for. If you’ve got a view model, it lets you figure out which nodes that model is bound to via the scope Knockout.js binding. Part of the reason it was so hard to get an [...]
astorm
I was helping a developer recently, (Want this sort of help? My Patreon beckons), who wanted to know how Magento determines if /pub needs to be on the end of URLs for static files. The short version? The default folders can be found here #File: vendor/magento/framework/App/Filesystem/DirectoryList.php public static function [...]
astorm
If you’ve been reading through my Advanced Javascript, UI Components, and uiElement Internals series, you’re aware that Magento have extended the Knockout.js template system such that Templates can be Loaded via ajax/HTTP Knockout’s “tag-less” bindings have tag equivalents The remote HTTP templates are a [...]
astorm
Back when Magento 2 was released, I noticed the much touted API didn’t have a method for fetching a product’s canonical URL. A year later that’s still the case. Magento’s reasoning and response, both from an engineering perspective and a product perspective points to a big cultural problem that goes beyond this [...]
astorm
Magento 2: Are uiClass/uiElement Imports/Exports order sensitive? The answer is mostly no. Imports/Exports values are fetched via the uiRegistry.get’s asynchronous callback method which means if the imports or exports attempts to access an item that doesn’t exist yet in the registry, the system will “wait” until [...]
astorm
Magento 2: Extract Currently Selected Product ID or SKU on Product Page Rian managed to dig up most of the data embedded in a Magento 2 product listing page that would let a programmer extract the Product ID of the currently selected product on a configurable product page. I threw together this quick RequireJS program that shows how you [...]
astorm
If you’re following along with my UI Component and uiElement Internals series, you know about Magento’s uiRegistry module. You can use this module to fetch the scoped Knockout.js view models by registered name requirejs(['uiRegistry'], function(reg){ console.log( reg.get('customer') ); }); or by using a callback function to [...]
astorm
That I’m posting this as a quickie probably points to the amount of time I’m spending with Magento 2’s internals vs. building out client sites, but I still haven’t internalized that Magento moved the the Design configuration options from Stores -> Configuration -> Design to Content -> Design -> [...]
astorm
Time to Report Bug: Two Weeks Over on alanstorm.com we’re in the middle of a series covering the internal implementation of uiElement objects. This series was prompted by some strange behavior in the default value system w/r/t observable objects. The linked bug report covers the details of why this happens, and why it’s a [...]
astorm
Be Careful with the “new-less” form of uiClass object instantiation Last time we said Magento’s uiClass based objects don’t require the new keyword. This is true. However, when you’re using the inheritance features of these objects its possible to supply a custom constructor. If you do this, and your custom [...]
astorm
In doing research for the new uElement Internals series, I discovered that Magento’s UI Component object constructors (uiClass, uiElement, uiCollection, etc) can create new objects without the use of the new keyword. //both return a new `UiElement` object object = new UiElement; object = UiElement(); This makes these constructor [...]
astorm
@api coverage for Magento 2 Javascript According to this forum thread from one of Magento 2’s architects, it sounds like Magento 2.2 is going to bring @api style coverage to Magento’s RequireJS module. This is a positive step in that it will clarify which javascript functions we can rely on working version to version. This is [...]
astorm
Wrapping up our uiElement defaults, we have the registerNodes defaults #File: vendor/magento/module-ui/view/base/web/js/lib/core/element/element.js defaults:{ /* ... */ registerNodes: true, /* ... */ } This is another node that you don’t need to worry too much about. Magento uses this to identify the uiElement objects in the [...]
astorm
Two defaults you don’t need to worry too much about are the containers and _requested defaults. #File: vendor/magento/module-ui/view/base/web/js/lib/core/element/element.js defaults: { _requesetd: {}, containers: [], /* ... */ } These are just properties that Magento’s initializing using the uiElement’s defaults [...]
astorm
The name and ns defaults #File: vendor/magento/module-ui/view/base/web/js/lib/core/element/element.js defaults: { /* ... */ name: '', ns: '${ $.name.split(".")[0] }', /* ... */ } are another pair of defaults that don’t make a lot of sense in the context of a traditional programming object system. Like the provider default, the name [...]
astorm
The next two defaults we’ll blitz through are the provider and source defaults. #File: vendor/magento/module-ui/view/base/web/js/lib/core/element/element.js defaults:{ /* ... */ provider: '', /* ... */ source: null, /* ... */ } We’re starting to get into the defaults that are tricky to understand since they involve both a [...]
astorm
The next uiElement default we’re going to talk about is the statefull default. Before we begin, let us bask is the programmer’s glory of the misspelling of “stateful” making it into a production release. The statefull default allows you to create a uiElement object with properties that will be automatically [...]
astorm
Earlier, we described the modules defaults for Magento uiElement javascript constructor functions. If you look at the uiElement definition, you’ll see there’s one modules default already configured for all uiElements #File: vendor/magento/module-ui/view/base/web/js/lib/core/element/element.js modules: { storage: '${ [...]
astorm
One Magento uiElement default you don’t need to worry about is the maps default, seen here in uiElement’s source file #File: vendor/magento/module-ui/view/base/web/js/lib/core/element/element.js defaults:{ /* ... */ maps: { imports: {}, exports: {} }, /* ... */ } This isn’t a magic default, it’s just the uiElement [...]
astorm