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.
I was investigating Magento 2’s TinyMCE implementation the other day, and came across this #File: vendor/magento//magento2-base/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js define([ 'jquery', 'underscore', 'tinymce', 'mage/translate', 'prototype', 'mage/adminhtml/events', 'mage/adminhtml/browser' ], function(jQuery, _, tinyMCE) [...]
astorm
Magento 2, KnockoutJS ViewModels, and Scope Binding A self answer from me over on the Magento StackExchange. The short version – Magento applies knockout bindings without a default view model. The Magento_Ui/js/core/app module/program, embeded via x-magento-init, adds view model objects to the uiRegistry. Finally, Magento has [...]
astorm
Magento 2’s core javascript library ships with a basic implementation of a class based object system, and the uiComponent feature uses these classes and objects extensively. The base class is the Magento_Ui/js/lib/core/class module/object/function, and you create a new instance of the class using javascript build-in new keyword. [...]
astorm
KnockoutJS: What Does Calling applyBindings Without Arguments do? Getting into Magento 2’s KnockoutJS implementation, and being slightly annoyed at the JS world. Knockout’s a great framework, but by positioning themselves as an MVVM framework they create the impression that Knockout itself is enough to contain your entire [...]
astorm
First, lets bask in the awful yet accurate glory of my original title for this quickie: Dependency Injection Argument Specific Instance Objects. If you’ve worked your way through my Magento 2 Object Manager series, you know its possible to tell Magento’s object system that a particular object should be instantiated every time [...]
astorm
Rackspace Magento Hosting Post Mortem – Dev Notes Rackspace has fallen a long way from the days of the defacto preferred Magento host.
astorm
Magento 2 Mock Fixing Speaking of Vinai, here’s a nice how to on adjusting Magento’s test mocks, and then some good typing on what would really fix them.
astorm
Magento’s documentation tells you to run tests with the following php bin/magento dev:tests:run unit This isn’t wrong, but it pretty time consuming. You’re running every test in the suite. This one liner will let you run an individual test vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist [...]
astorm
Magento 2: Set a PHP umask It sounds like the latest version of Magento adds the ability to set a umask for PHP, which means another barrier to getting Magento up and running in industry standard, mod_php system (i.e. shared hosting and your laptop) has been knocked down. Looking forward to giving this a try when I have a moment. I know [...]
astorm
Magento 2: Sort Order gets Weird for “Around” Plugins Interesting bit of insight from Anton Kril on plugin firing order. My naive assumption on how this would work was All before plugins fire The around plugin chaining happens All after plugins fire However, based on what Anton’s said here, it sounds like an around [...]
astorm
If you grab the latest version of pestle (updated minutes ago) you should be able to use the following set of commands to create a base module with a working admin route. $ pestle.phar generate_module Pulsestorm HelloAdminPestle2 0.0.1 $ php bin/magento module:enable Pulsestorm_HelloAdminPestle2 $ php bin/magento setup:upgrade $ [...]
astorm
Magestead – The Vagrant Solution for Magento Developers Magestead just released version 2.0, with support for Magento 2. Another vagrant box to checkout if you’re looking for a way to get a sane Magento 2 enviornment up and running.
astorm
While phrases like “should we be be doing this in 2016” abound in engineering discussions, down in the trenches an arbitrary SQL query is often the fastest, most expedient way to get at the data you want. While I still regularly encourage developers new to Magento to embrace using the models and API resource models when [...]
astorm
Two good Stack Exchange answers from Raphael at Digital Pianism covering how to add a custom icon to your Magento Admin Menu Items. In short – these menu items use a custom font character, defined in svg file that’s (somehow? via LESS CSS?) converted to an embedded OpenType font. This custom font uses the Private Use Area of [...]
astorm
In Magento 2, when you’re working in phtml template files, you’ll see two ways to make method calls to the block object, one using $this, another using $block $this->someMethodCall(); $block->someMethodCall(); The $block variable is new in Magento 2. It contains a reference to an instance of a template’s block [...]
astorm
Creating an MCV/MVVM landing page for Magento 2’s frontend cart application is relatively simple. You create a routes.xml file so your module can “claim” a frontname, then then create a controller class that’s named correctly to catch a particular URL pattern. This is even easier with pestle, my PHP CLI module [...]
astorm
Just a quick bit of advice for folks getting into Magento 2 development, which probably applies to Magento 2 development as well. If you’re building backend admin components, it’s a good idea to not rely on the default, Super User admin account when you’re developing and testing. There’s a few parts of the admin [...]
astorm
One last bit on the area setting object in Magento 2. There were times in Magento 1 where it was necessary to temporarily pretend you were running code in one area, even though you were in another. One famous example of this was using Magento’s catalog/product objects to directly save product information while on the frontend. In [...]
astorm
Reader Vinai Kopp (of Mage2Katas fame) wrote in with a interesting bit of functionality in the MagentoFrameworkAppState class we talked about in the Fixing Area code Not Set Exceptions quickie. Specifically, Vinai had a bit of code that was shared between a command line context, and a web context, and if he tried setting the area code [...]
astorm
nexcess/magento-alarmbell Meanwhile, back in the real world, away from the bleeding edge of Magento 2, Nexcess has just released a simple-but-useful open-source extension that will log and notify users when there have been been admin user changes made to their Magento system. I’m not responsible for maintaining any active Magento 1 [...]
astorm