Drupal

Composer alias vs composer replace for downgrading/removing drush

I was wrestling with composer yesterday to try to get Drush 10 out of a project where I wasn’t ready for it (because while Aegir is amazing, drush 9+ support is still a WIP).

My first instinct was to use “alias”:

composer require drush/drush:"8.4.6 as 10.3.6" --update-with-all-dependencies

That worked, but I don’t actually need drush to be installed in my prod encironment at all, but it is in require in a dependency. That’s when Andrii told me about “replace”:

    "replace": {
        "drush/drush": "^10"
    },

In… a fun loophole/feature, if you use replace but don’t specify a replacement, it acts like ignore.

๐Ÿคฏ๐ŸŽ‰

I had a wonderful #OpenSource moment yesterday...

Our team at YMCA of the USA was midway through pushing updates to 150 sites on our Drupal PaaS offering when another Open Y partner agency’s team shared in Slack that they’d discovered a major issue with the code we were in the middle of deploying! ๐Ÿ™€ Even worse, when I started looking at the issue, it turned out to be a bug that I’d helped to introduce into the codebase. ๐Ÿ™€๐Ÿ™€

Over the course of yesterday, teams from around the world collaborated to push not one, but four fixes that we’d discovered. This was all made possible because the Open Y community has decided to work collectively, even as agencies competing for the same customers, in order to extend the YMCA mission into digital spaces.

Thanks to everyone who helped make these fixes possible. Our sites are better together!

When is a number not `input type='number'`?

When it “only consist[s] of numbers but isn’t strictly speaking a number”. See Why the GOV.UK Design System team changed the input type for numbers for more details.

While Drupal supports #pattern on FormAPI elements, there’s no top-level property for #inputmode. That can be added via #attributes, like:

$form['textfield'] = array(
  '#type' => 'textfield',
  '#title' => 'Any number of digits',
  '#pattern' => '[0-9]*',
  '#attributes' => [
    'inputmode' => 'numeric',
  ],
);