In Magento 1, it was pretty common to write a bit of layout update XML that looked like the following. <reference name="head"> <action method="setLabel"> <label>skin_js</label> </action> </reference> This XML translates roughly into the following PHP pseudo code $block = $layout->getBlock('head'); [...]astorm
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.
One of the bigger changes to Magento 2’s layout system is how a end-user-programmer uses layout handles. In Magento 1, layout handles were top level configuration nodes in a set of layout update xml files <handle_name> <!-- layout update xml nodes --> </handle_name> In Magento 2, layout handles are individual XML [...]astorm
Magento 2 introduced a new node type to its Layout XML DSL — the <arguments/> and <argument/> node. #File: vendor/magento/module-shipping/view/frontend/layout/sales_guest_view.xml <referenceBlock name="sales.order.view"> <block class="Magento\Shipping\Block\Tracking\Link" name="tracking-info-link" [...]astorm
This in an interesting Magento layout technique that came my way via Vinai Kopp (of Mage2.tv fame). Magento 2’s automatic constructor dependency injection system presents a problem for class trees with multiple levels of inheritance. First, programmers end up needing to call parent constructors with the right arguments, and in the [...]astorm
Debugging cron jobs is one of my least favorite activities. This clever tip over on Stack Overflow shows how to use cron and the env generate the enviornmental variable your system’s cron runs under, which in turn will let you pretend to be the cron job. (This won’t help you if you’re using a PHP system that layers its [...]astorm
One long time resident of my ~/bin folder is lns lns — a friendly program for making symbolic links For whatever reason I’ve never been able to get the argument order to ln -s memorized. The lns perl script (which has always run out of the box on system provided perl without issue) make it so I never need to. Whether you lns [...]astorm
Speaking of composer and sematnic versioning, here’s a neat web page that will List all the avaiable versions of a particular packagist package Highlight which versions composer will pick when you use a particular set of SemVer characters Useful when you’re chasing down composer dependencies — although this project (as [...]astorm
I checked some code into pestle (my PHP command-line framework and Magento 2 code generation tool) for the first time in a bit, and was greeted with a broken travis build (for PHP 5.6). Digging into the problem, I saw a sight that’s become increasingly familiar to PHP developers in recent years $ composer install Loading composer [...]astorm
While Laravel’s a fantastic framework, I don’t think anyone would ascribe Plays Well with Others as a core tennant of the project. i.e. Using individual Laravel components like the Eloquent ORM in your own projects is never a straight forward affair. They’re just not designed for that use case. This makes projects like [...]astorm
On of my work hobbies is finding a way to replace Dominant Accounting Software package in my life, and because I’m a programmer (and a little weird) that means writing one off applications to repace the functionality of Dominant Accounting Software package. This is why today’s links are the wikipedia PostScript page and [...]astorm
GNU Make is the original build system and, strange modern outliers asside, is mostly used (and useful) in C or C++ based projects. It’s syntax reflects 40+ years of — organic? — growth, and I was happy to discover this free O’Reilly book that grounds you in the fundamental concepts.astorm
Magento developer of note Daniel Sloof recently tweeted about the open sourcing (MIT) of — his? his company’s — Magento 2 Clean Checkout extension Breaking a couple months silence to bring you guys an early christmas gift: https://t.co/dIi6J9mLx0 A drop-in replacement for #Magento2 Checkout. Commercial project turned [...]astorm
Coming at C from a “test legacy code first” point of view is tricky. All those neat test framework features for testing code not written under test (i.e. mocks, etc.) rely on a language’s dynamic nature for implementation details. You don’t get that easily in C, so it was a pleasure to be introduced to the cmocka framework. [...]astorm
I’m not sure if the talks (i.e. videos) from the recent MageTestFest conference will show up online, but these slides from Vinai Kopp are worth a link, if only because they capture most of the weird, non-obvious incantations you’ll need to run Magento 2’s unit and integration tests.astorm
You can’t walk ten steps in this businesses without hearing Engineering is a set of tradeoffs. You rarely hear the other side of that: and sometimes we make the wrong tradeoffs which lead to living with garbage behavior for years. PHP leaks memory like a sieve. By leak we mean during a long running PHP request the amount of memory [...]astorm
This one came out of a conversation in my Patreon mentoring Slack room. Someone was having trouble with their Magento 2 object manager configurations (di.xml) not showing up — but only during checkout. Their problem? They were dropping their di.xml files into the frontend folder etc/frontend/di.xml This is good enough to get class [...]astorm
TLDR; There’s a real .dev top level domain that Google owns (and Amazon previously tried to buy), and a recent Chromium nightly (Google Chrome’s browser engine) automatically redirects all .dev domain names to an HTTPs version of the site. Chrome to force .dev domains to HTTPS via preloaded HSTSastorm