Thanks to some late, post merchant beta changes made to Magento, distributing modules via Composer (PHP’s de-facto package/dependency manager) has never been easier. While we’re all interested to see how the new Marketplace turns out, thanks to Magento 2’s architecture changes we should all be able to distribute our [...]
astorm
Permission issues with static generated files in pub directory · Issue #2412 · magento/magento2 I built my first website in 1995 – which means I’ve had over 20 years of battling unix file permissions. Or, more appropriatly, fighting the software world’s myriad ways of dealing and not dealing with them.
astorm
A quick, semi-regular roundup of open Magento 2 technical questions. How to use ui_component Magento introduces a new layout handle XML node named uiComponent that lets you insert specific user interface elemnts into your application. Unfortunately, documentation on how to use this is woefully incomplete. The documentation that does [...]
astorm
I’m seeing the following error a lot when running bin/magento setup:upgrade Missing write permissions to the following directories: ’/Users/alanstorm/Sites/magento-2-with-keys/magento2/pu b/static’ Extra frustratingly – if I look at every file and directory in pub/static, they all have fully world readable, [...]
astorm
These methods aren’t, as of 2.01, marked as @api safe so they may go away. That said, they’re pretty integral to how the layout works so I feel like they have a good shot of sticking around. If you want to add a frontend asset to your page layout programmatically and not render the <link/>/<script/> tags yourself, [...]
astorm
Not strictly a Magento 2 thing, but if you have code that looks like this in your extension namespace FooBazBar; //... if( $node instanceof SimpleXMLElement) {} You’ll need to make sure that SimpleXMLElement is actually used in your current namespace. namespace FooBazBar; use SimpleXMLElement //... if( $node instanceof [...]
astorm
As promised, today we're going to show you how to add javascript and CSS files to your Magento module without needing to worry about how their paths are rendered or how Magento serves them. While you may find this article useful on its own
astorm
Quick heads up if you’re using Magento 2’s __ function to translate strings in your extensions. Magento 1’s translation functions allowed you to use sprintf style replacement tokens. Mage::helper('module')->__('Hello %s', $string); $this->__('Hello %s', $string); Magento two opts to use a globally accesible __ [...]
astorm
Using PHP Code to Generate Asset URLs in Magento 2 Question and answer from yours truly on using the asset repository to get the full URL to Magento 2 frontend asset files. The short version – inject a MagentoFrameworkViewAssetRepository, use $repository->createAsset('Vendor_Module::path/to/file.js') to create an asset object, [...]
astorm
We interrupt your regularly scheduled Magento tutorial for a quick announcement about a new (Magento related project) I've been working on.
astorm
Based on some early theme conversion work in Magento 2 – it looks like the view.xml theme fallback is an all or other thing. If your new theme’s view.xml file is missing an image that’s defined in the parent theme file, Magento explodes when trying to find the parent image file.
astorm
Can’t Create URLs Shorter than Three Characters · Issue #2910 · magento/magento2 Reminder: In Magento 2 (as in Magento 1) a route’s name is how Magento internally identifies the route, and uses it for creating things like layout handles. The front name is what shows up in the URL bar. These are very often the same, but [...]
astorm
Genmato/M2_Sample Nice sample extension with a lot of Magento 2 features.
astorm
Can’t Create URLs with Single Dashes · Issue #2910 · magento/magento2 One of the downsides of creating a new framework is you end up creating the same problems that have already been solved in other frameworks. For some reason Magento 2 wants all URL “front names” (the first URL segment) to be three characters long, and [...]
astorm
Magento 2: Different static-asset Files Per Locale? To save you a click view/[area]/web/hello.js view/[area]/web/i18n/fr_FR/hello.js
astorm
Last time we discussed how Magento serves and generates front end (javascript, css) files to end users from its own modules. Like most of Magento's feature, if it's done in a core module, third party developers can do it in their own modules. This
astorm