Drupal Planet

My Drupal Core Contributions for week-ending July 19th, 2024

Code Enigma Logo

Here's what I've been working on for my Drupal contributions this week. Thanks to Code Enigma for sponsoring the time to work on these.

I focussed on the core Stable9 theme again this week. And damn was that frustrating. 

An issue I thought (hoped?) we had fixed last week where Stable9 used to override Drupal core's off_canvas library, but now has no matching CSS files. The tests were failing, but I couldn't figure out why - it was reportedly missing the off canvas files, but that was a good thing, since they don't exist. 

An hour later, after putting the off_canvas libarary name back into the $librariesToSkip variable, I got that test running again. Only to discover that a functional JavaScript test was now failing. And so I spent another hour figuring that out. Only to discover that it was a red-herring and the failing test was a blip in the CI tools. So ... now all the tests are passing and we should be able to get this committed. 

I think I need a shower after all that.

Don't shower yet, Mark, you're not finished. 

Oh really? Yeah, remember that cool merge request from 2 weeks ago to set the dates for each node in Umami to a unique date? Well, that also has a failing test. But only if you install Umami using Spanish as the default language.

My Spanish isn't very good - it's non-existant - so trying to track down the cause of that failing test was about as enjoyable as you can imagine. But ... I tracked it down, so hopefully we'll also get that merged now as well.

Thanks to Code Enigma for sponsoring my time to go through this masochism 😀

Update

  1. The stable9 issue got merged later this afternoon, and
  2. The Umami issue got set to 'Reviewed and tested by the community" this afternoon, so
  3. That's all good news, and
  4. I can now go for that cold beer!

 

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My LocalGov Drupal contributions for week-ending July 19th, 2024

Beautifully crafted digital products and experiences that matter.

Here's what I've been working on for my LocalGov Drupal contributions this week. Thanks to Big Blue Door for sponsoring the time to work on these.

I'm wrecked after all the work this week, but in a good way! Another really enjoyable week making LocalGov Drupal better for everyone. I'm particularly excited about the module I started working on that will allow site users to navigate their LGD backends via keyboard shortcuts. Can't wait to work on that more in the coming weeks.

Need LocalGov Drupal services? Give Big Blue Door a shout.

Meetings and Meet-ups

  1. Merge Tuesday. Docs got a good looking at in this week's Merge Tuesday. It's always good to make a documentation better. We also had a nice merge of demo content for publications, and started looking at a template for PRs so when you create one the reviewers will have a better idea of what is happening.
  2. Netcall/LGD working group: We had a good look through connecting the Netcall call center data with a Drupal website, so content designers can see what the most popular items people are calling about and target content towards this.
  3. Community Meet-up: I always enjoy this to see what else people are working on and what features people want us to work on. This week I gave a presentation on the upcoming features for Drupal 11.
  4. Tech Group drop-in: Well this week's meet-up certainly got down to details. We talked about using migrate module to pull data in to your website on a continuous basis. We also talked about creating a glossary of terms for a jargon buster. And we finished off talking about how to create events.

Code Contributions

  1. I usually spend a decent amount of time in Slack each week, helping out any one who posts an issue there, so they have a good "customer experience" from LGD and get their issues solved quickly. This week this led to me creating an issue to fix our accordions when printing. Since only 1 accordion opens at a time, you can't see all the closed ones if you print the page. Well, you can now.
  2. Given the backlog of PRs we now have since we have more people working on issues, I spent a good amount of time again this week reviewing what I could so we could get more items merged. I'm trying to spend about 2 hours per week on this task to keep the number of open PRs as low as possible.
  3. I got some more work done on the NHS base theme, specifically the breadcrumbs area, background color for the body element and the screenshot used when selecting a theme.
  4. We've had an issue open to create an admin role for LocalGov Drupal since late April. We have a PR for this to add an admin role to new LGD sites, now we have a second PR adding a module which will allow existing sites to have an admin role as well if they want it. This approach will, then, allow us to use this module to apply any updates that we might want to the admin role.
  5. After all my hard work getting a sticky header working in LocalGov Base, Maria's eagle eyes noticed that I was applying the same JS/CSS to the sticky version as I was to the scrolly version. And with minutes to go before Merge Tuesday ... we got it fixed.
  6. I created an experimental module to allow us to navigate a LGD website via keyboard shortcuts. There's a blog post and video to explain it, and the code is available on GitHub. Next up: create a mechanism for it to work with all admin menu URLs. Then ... create a settings page so councils can create their own shortcuts. This really excites me!

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

Keyboard Navigation for a LocalGov Drupal website

Navigating a LocalGov Drupal backend via keyboard shortcuts

Wouldn't it be cool if we could get around our LocalGov Drupal websites by using keyboard shortcuts?

I had an idea for a module to allow us to navigate our LocalGov Drupal websites by keyboard shortcuts. Thanks to Big Blue Door for sponsoring my LGD-contribution time, I was able to put a proof-of-concept together yesterday evening to show off my idea.

It's quite simple. I created a new module called "LocalGov KeyNav" and put the code on GitHub on my own namespace for now. Now, when you have that module enabled, you can type "lgd" followed by a series of keys and get to different pages on the site. For example:

  • ac - goes to the content listing page
  • ap - goes to the people listing page
  • acdf - goes to the directory facets page
  • t2 - goes to the 2nd item in the toolbar menu (usually admin/content)
  • t8 - goes to the 8th item in the toolbar menu (usually admin/config)
  • nasp - goes to the "Add service page" form
  • naslp - goes to the "Add service landing page" form

We can add as many more sequences as we want.

Here's a video showing it in action.

If you think this is worth pursuing, let me know in the comments on YouTube or via the LGD Slack or any other way. Thanks.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My LocalGov Drupal contributions for week-ending July 12th, 2024

Beautifully crafted digital products and experiences that matter.

Here's what I've been working on for my LocalGov Drupal contributions this week. Thanks to Big Blue Door for sponsoring the time to work on these.

Meetings and Meet-ups

  1. Merge Tuesday. As usual, lots of things got merged, then we got down to a very interesting discussion about managing external libraries in our repos, based on the PR I have for bulk adding media items to our sites. We also got the cool new "Add to calendar" feature merged to LocalGov Base, which has been asked for for a long time by content designers.
  2. Content Group. We had a really interesting content group meeting this week, going through the documentation initiative for LocalGov Drupal.

I worked on two large issues this week: adding sticky header feature for LocalGov Base theme and creating a base theme for NHS websites. Let's see how it all unfolded.

Code Contributions

  1. I started working on an issue to add a sticky header feature for LocalGov Base. We have an idea in LocalGov Drupal that says "Make the hard stuff easy". A sticky header is a really good example of this, it's not easy to figure it out because of all the bits and pieces that can get in the way - are there items above the header, below the header, etc? Do items in the header affect it? Will it break existing websites? I spend most of Monday figuring out this in a way that can work for all councils. It's not perfect yet, but it a very good start for us, and comes as part of the LocalGov Base theme settings so any subtheme of this can inherit it.
  2. We are getting a backlog of open pull requests that need to be reviewed or have been approved but not merged. I spend time reviewing lots of PRs so we could merge as many as possible at Merge Tuesday.
  3. Everyone wants to help LocalGov, but not everyone knows where to start. So I wrote a blog post to help you get started.
  4. When you use the theme generation script in localgov_base, the subtheme that is created sets itself as compatible with Drupal 8, Drupal 9, and Drupal 10. I fixed that so now our subthemes are compatible with Drupal 10 and Drupal 11.
  5. If you use the linter script we created so your theme's CSS will follow Drupal's coding standards, we ship a .nvmrc file with it which stipulates Node 16 as our approved version. However, Node 16 is no longer supported, so I now have a PR created to set Node 20 as our approved version of Node, which is the current LTS version.
  6. The BIG one: there's been a lot of talk recently about using LocalGov Drupal for NHS trusts and other NHS sites. So, I went and started work on a base theme for the NHS.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My Drupal Core Contributions for week-ending July 12th, 2024

Code Enigma Logo

Here's what I've been working on for my Drupal contributions this week. Thanks to Code Enigma for sponsoring the time to work on these.

This week was all about helping out in the Stable9 issue queue. Let's see how much we got done thanks to Code Enigma's sponsorship.

  1. The MR I created last week to ensure that all content in the Umami theme was inside a landmark region was further worked on by my Umami co-maintainer Finnsky. I spent some time further working on this work to tie the rest of the template and CSS together. I think what we have now is a very good layout system that will work just as well for screenreader users.
  2. I've been tinkering around at the edges of becoming a maintainer of the stable9 theme for a while now, but haven't had much time to work seriously on it. Today I got to have a good look at an issue that has been open for a number of years, saying that the system-modules-uninstall.html.twig file has an error with the {% trans %} tag. After testing, it seems fine, so I think that issue outdated, or at least needs more info.
  3. Drupal 10 updated its library for off-canvas, which is being overridden by stable9. However, now stable9 is referencing the old CSS off-canvas files which no longer exist. There's an MR to fix this, which seems to work fine, except there's a test broken somewhere. I'm trying to track it down so we can get this issue finished off and merged.
  4. I think I've tracked down why the tests are failing for the stable9 off_canvas override. All the CSS files for that override were removed so it's not actually trying to override the core library any more. That was a bit more of a rabbit hole than I expected it to be.
  5. Another stable9 issue whereby the tabledrop handles were not correctly placed. It's been open for years as it was affecting stable theme from Drupal 8. After some digging, I think it's actually a red herring issue and is actually affecting the Seven theme rather than our stable themes, so it's not marked as outdated.

What an enjoyable week that was, and now we have the stable9 issue queue down to only 3 open issues tagged as "Active", or "Needs work", or "Needs review".

Thanks to Code Enigma for again sponsoring my time to make Drupal better for everyone.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

Want to contribute to LocalGov Drupal, but don't know where to start?

Beautifully crafted digital products and experiences that matter.

Contributing to LocalGov Drupal is a great way to get used to how the platform works, and, in turn, makes the platform better for everyone. Here's some thoughts on how to get started.

Thanks to Big Blue Door for sponsoring my time to work on LocalGov Drupal.

Ideas to get started

Contribute what you want

I think the first thing to think about when contributing to LocalGov Drupal - indeed to any open source project - is to contribute what you want to contribute. We are always open to see what someone wants to contribute, and it might be a great idea we haven't thought of ourselves. If it's suitable, we'll accept it or ask for some modifications to bring it into line with our standards. If it's not something we are interested in, at least you have gained that knowledge too.

As an organisation, consider being a stakeholder of an initiative

All agencies have specialties. If yours is accessibility, have a look and see what accessibility needs LocalGov Drupal has. If you speciality is performance, perhaps do an audit of hour our sites fare, and suggest improvements. If your speciality is something else, figure out where we are falling short of your high standards in this area and help us make it better.

Perhaps you'd like to become known as "the agency" that does X in LocalGov Drupal. Be that agency and take a vested interest in a feature - blogs, directories, news ... whatever. It's always handy if someone has a question for us to be able to say "go chat with [your agency name here] about that".

If you are feeling really adventurous, you could propose a whole new feature for LGD and if it's a good idea, go build it. That's how I got started, I proposed a re-write of the entire frontend of LocalGov Drupal.

Ask questions

Instead of looking to contribute something specific, how about you hop on to the Slack and just ask questions for things you need to know about LGD. Then when you get answers, use that information to add to the documentation to benefit everyone. Or create tutorials and videos to show off what you now know.

Check the roadmap

We have a roadmap of activities on the LocalGov Drupal website. Have a look at it to get an idea for where we are going in the coming months and see where you can be of help.

Come to a meeting

We have lots of meetings. Come to some, learn, ask questions. After a few of these you should have lots of ideas for ways to help us out.

  • Merge Tuesday to you know what new features have been released
  • Tech group drop-in to ask any technical questions you might have
  • Tech group governance to find out about who is maintaining what
  • Content group to learn about how council content designers are using the platform
  • Product group to see what we are working on
  • And many more

Ideas for specific skills

Developers

We have two bookmarks on the technical group Slack channel

  1. Pull requests that need to be reviewed
  2. Pull requests that need to be merged/have been reviewed

These are two great places to get started. Someone has already done the work, but we are always stuck for people to help out reviewing it before it can be merged.

Frontend Developers

Have a check on the LocalGov Base repo. That's our main frontend repo. 

Following that, have a look at the LocalGov Microsites Base repo. That's the main base theme for microsites. There's a few niggling issues there about the menu system (especially for multi-level menus).

LocalGov Claro is our base admin theme. I really like it, and there's very few issues, but I'm sure it could be better.

Backend Developers

The main bulk of our project is backend work. Check any of the repos issues and there should be something for you - Guides, Step-by-Steps, Services, Directories, etc.

Content People

Documentation can always be better. have a look at our docs site and see what's missing. For example, if you look at the Designers page on the documentation, you'll see we have a link to news wireframes that links to a private PenPot. It would be good to find out if we can get an image of the wireframes and add them to the docs site.

Hopefully those ideas will spark your imagination and I'll see you soon contributing as much as possible to this great public resource.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My Drupal Core Contributions for week-ending July 5th, 2024

Code Enigma Logo

Here's what I've been working on for my Drupal contributions this week. Thanks to Code Enigma for sponsoring the time to work on these.

One of the patches I wrote last week got merged on the day I wrote it. That's the fastest I've ever seen an issue go from being reported to being fixed and merged. Let's see how this week goes ...

  1. All demo content created with the demo_umami_content module is created with the same timestamp. This is fine in general, but we have some views that sort items by their created date, which is moot since they all have the same created date and time. Catch created an issue for this, and I created a merge request to set each node as being created one day after the previous node, so our sorting will work better. We have 19 nodes created with the demo content module, so this means:
    1. Node 19 was created yesterday
    2. Node 18 was created 2 days ago
    3. Node 17 was created 3 days ago
    4. and so on
  2. Sometimes you find gems, such as an accessibility issue we have open for over 5 years noting that the Umami theme does not have all of its content inside HTML landmarks. There's two solutions for this - move all the content that is outside of the <main> element to inside it, or create a new <section> to place all that content. I created a merge request to place all the content inside the <main> element, at least to get the conversation started.
  3. I started on an issue about 2 years ago to stop using hardcoded CSS values in the Umami theme and start using CSS variables. I had it in such as way that it was ready to merge - I thought - until the issue started expanding to include SVGs as well. Now we've moved half of our Umami CSS to Single-Directory Components, so that MR doesn't work any more. I'm now starting to think about how to get it redone in our SDC-enabled world. That's going to be next week's task.

Woah, another very enjoyable Friday making Drupal core better than it was yesterday. Thanks to Code Enigma for sponsoring this time.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

A bash script to install different Drupal profiles the easy way

Code Enigma Logo

Over the past few weeks I've been sharing handy ways to set up Drupal for easier Drupal core development. Here's a bash script for installing Drupal and allowing you to choose what profile you want.

When contributing to Drupal core, or any distribution of Drupal like LocalGov Drupal, or doing anything that needs you to install and reinstall Drupal a lot, it gets frustrating having to go through the same steps. 

I often hit the up arrow to use my last command in my terminal which might look something like this:

ddev drush si standard -y && drush cex -y && git add config/sync && git commit -m "config" && ddev drush uli

What does that do?

  1. Installs Drupal using the standard profile
  2. Exports the default config to the config/sync directory
  3. Adds this config to a dummy git repo that goes no where - this is so if I need to do something that changes config, I can re-export the config and do a git diff to see what changes I need to add back in to my module/installation profile
  4. Gets me a login link

However, I often need to install the Umami profile, since I am a Drupal core maintainer for that. And I often need to install the LocalGov Drupal profile, since I am the frontend lead for that project. And sometimes I need to install the demo_content module with LocalGov Drupal. 

With all that in mind, I decided to create a bash script that would install any of these profiles and allow me to choose which one when I run it. Here's the script:

#!/bin/bash

set -x

#!/bin/bash

echo "What profile do you want to install?"
options=("Standard" "Umami" "LocalGov" "LocalGov (with Demo Content)" "LocalGov Microsites" "LocalGov (with Elections)")

# Check if a command-line argument was provided
if [ $# -gt 0 ]; then
  # Use the command-line argument as the profile selection
  profile_selection=$1
else
  # No argument provided, fall back to interactive selection
  select profile_selection in "${options[@]}"
  do
    break
  done
fi

case $profile_selection in
  "Standard" | 1)
    ddev drush si standard -y
    ;;
  "Umami" | 2)
    ddev drush si demo_umami -y
    ;;
  "LocalGov" | 3)
    ddev drush si localgov -y
    ;;
  "LocalGov (with Demo Content)" | 4)
    ddev drush si localgov -y
    ddev drush en localgov_demo -y
    ;;
  "LocalGov Microsites" | 5)
    ddev drush si localgov_microsites -y
    ;;
  "LocalGov (with Elections)" | 6)
    ddev drush si localgov -y
    ddev drush en localgov_elections_demo_content -y
    ;;
  *)
    echo "Invalid option. Please run the script again with a valid option."
    exit 1
    ;;
esac

ddev drush cex -y
ddev drush cr

# wait 3 seconds, so the config has fully exported
sleep 3
git add config
git commit -m "config"

ddev drush uli

This script gives me six options:

  1. Standard - the standard installation of Drupal
  2. Umami - the Demo Umami profile
  3. LocalGov - the default LocalGov Drupal installation profile
  4. LocalGov (with Demo Content) - installs the demo content module after installing LocalGov Drupal
  5. LocalGov Microsites - the LGD microsites platform profile
  6. LocalGov (with Elections) - enables the elections suite of modules, I needed that lots over the past few weeks

Now, when I want to re-install Drupal, I can run bash _install-drupal.sh (it has the underscore so it stays at the top of the directory I have it saved in). That will then ask me to enter 1-6 for what profile I want to enable, or I can run bash _install-drupal.sh 2 to install profile 2, which is Demo Umami.

This came in very handy today when working on a hook_install() to set various created dates for the demo content in the Umami profile. I had to reinstall the site to test it about 20 times, so this was a real time-saver.

After the profiles install, I then export the config. After that I wait 3 seconds, if not the git add config often doesn't get all the config and the directory may not have finished getting cleared out and restocked.

I hope that help you. If you have any improvements, I'd love to hear them.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My LocalGov Drupal contributions for week-ending July 5th, 2024

Beautifully crafted digital products and experiences that matter.

Here's what I've been working on for my LocalGov Drupal contributions this week. Thanks to Big Blue Door for sponsoring the time to work on these.

Meetings and Meet-ups

  1. Merge Tuesday. We got enough merged today to - hopefully - have a stable release of LocalGov Elections this afternoon. Then we had a very deep conversation a patch failure for LocalGov Services that is stopping councils from upgrading to Drupal 10.3.
  2. Tech Group Drop-in. We worked on clearing the last stable blockers for the LocalGov Elections module. We succeeded and tagged a 1.0.0 release.

Code Contributions

  1. I rewrote part of my PR to change the title structure of elections results pages, to make sure some views pages didn't break when trying to access the results.
  2. We have a number of dev and beta modules in the LocalGov Elections suite, so I spent some time testing the latest stable versions of these to see could we remove the dev versions - we could!
  3. The results timeline feature is proving to be a tricky piece of work to get right, so we have decided we don't need it for the upcoming elections, but that it will be very handy for the local elections. I created a PR to remove it for now.
  4. We have a checkbox to turn off the number of votes needed for a majority - since it's not needed on some election types - but some people were skipping it by accident. We have now a PR to ensure that the setting is always false when viewing a national parliamentary election, such as the on e in the UK this week.
  5. And then we decided that wasn't the approach we wanted to take, so we now have another PR to simply set that field as off by default instead.
  6. I'm a big fan of consistency and separating concerns, so it's always frustrated me that we use the same view mode in LocalGov Drupal for our teaser listings (e.g. news listing) and our card listings (e.g. featured news items). Why not have a consistent way of styling cards and a separate consistent way of styling teasers (and other view modes). So now we have a PR to do just that - add a card view mode to LocalGov Drupal. It even has an update hook so all LGD sites can take the same approach.
  7. We had a PR to add the "Compare revisions" button to the top of the page (as well as the bottom) but it seems the maintainers of the Diff module have implemented it already so we don't need to. I then updated my PR to make the button sticky at the top of pages when you scroll which is helpful if there's been a lot of revisions and you can't see the top or bottom of the list on your screen.
  8. Tests are very important to the LGD team, we try to have as much test-coverage as possible. I hadn't realised, but our LocalGov Claro theme didn't have any tests, so I created a PR to add our default theme test suite to it.
  9. Sticky headers are a common feature on websites - always sticky, or sticky when you scroll back up the page, etc - so why not create that feature for LocalGov Base so we have it available for all councils if they want it. I started work on that this week, but it tricky to get config updates into themes since they don't have a .install file. I've now also started a LocalGov Base Supports module to solve this. Hopefully I'll get it finished next week.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My Drupal Core Contributions for week-ending June 28th, 2024

Code Enigma Logo

Here's what I've been working on for my Drupal contributions this week. Thanks to Code Enigma for sponsoring the time to work on these.

I got two pretty nice things completed this week (I only had time to spend a half a day on Drupal contributions this week). Both took a lot longer than expected. You win some, you lose some!

  • I love how easy it is to turn on Twig debug settings via the new admin/config/development/settings page. However, I get frustrated everytime I click the first checkbox, because it exposes more options and which then moves the second checkbox down the page. So I thought, let's create an issue to swap the order of these two checkboxes, and of course a merge request to go along with it. It's a pretty small change, but damn it took ages to do as I managed to get myself into a git conflict hell-o-rama creating the branch.
  • I created a module about 2 years ago called LocalGov Sa11y, which integrated the Sa11y accessibility checker into LocalGov Drupal websites. However, it's a very generic module, so I decided to make it available on Drupal.org instead so any Drupal website can use it. I contacted the owner of the https://drupal.org/project/sa11y namespace and asked if I could take over it. I expected a response next week or some future time, but they got back instantly and made me a maintainer of it. So now we have the Drupal Sa11y module available on Drupal.org, sponsored by Code Enigma. Pretty cool.
  • I thought it would take about an hour to put that module on Drupal.org but it took over 2 hours, by the time I had finished removing all the old code, adding my code, removing all the references to LocalGov Drupal, closing all the old issues, updating the project homepage, etc.

Drupal and other open source products get better when people can spend the time to work on it, either because they have spare time or they are funded. Thanks so much to Code Enigma for sponsoring my time.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).