June 1, 2020
I previously wrote about how to create a View of content from a Group that a user is a member of. For another site, I have to show a list of other members in the same group on user profiles. Another common use case might be showing a logged-in user a list of other members in his/her group(s).
You can do this two ways:
Create a View of Group Content of type [Group name]: Group membership
Continue reading Create a View of other members of a Group - Drupal 8
May 19, 2020
Drupal has gotten so much more powerful and easy to work with, but there are still a few things that are missing that seem like they should be a given. Such as, the ability to format certain Views exposed filters, like node titles or Group names, as dropdown select lists rather than an empty textfield that requires the user to know what the possible options might be instead of presenting them.…
Continue reading Group names as Views exposed filter select list - Drupal 8
January 14, 2020
The Group module is a powerful one I turn to often when a site has a requirement for groups of users who should have specific permissions, access to edit or view specific content, etc.
A common requirement is to show a list of content belonging to the Group(s) a user is member of, using Views. That isn't as straightforward as it seems. I recently had to do this and struggled a bit, so thought…
Continue reading Create a View of content from Groups a user is member of - Drupal 8
October 9, 2019
I've worked on several sites recently where the site search form is hidden by default and displayed by activating a button. This pattern caused me a bit of confusion about where to put the role="search" attribute, which is important for accessibility.
According to the W3C specification the search role is:
A landmark region that contains a collection of items and objects that, as a whole, combine…
Continue reading Accessibility: where to put the search role when your search form is hidden
October 3, 2019
I'm working on a website which has a list of products, displayed in a View. Each product has an "provider" who produces it, associated with the product content type by an entity reference field to a Provider content type and displayed in the view. The client wanted contact information for the providers to show up in the list as well.
It would have been a bit bulky and repetitive to have the…
Continue reading Show complementary information in a View based on exposed filter choice - Drupal 8
October 2, 2019
Hatticus is a fun, cabled hat with a pointed top and pom-pom knit in super-bulky yarn. Due to the giant yarn and needles, it's a super-fast knit.
Feel free to leave a comment here or send me a message with any questions or corrections.
Hatticus: Free Super Bulky Cabled Knit Hat Pattern (PDF)
Continue reading Hatticus: Free super-bulky cabled knit hat pattern
September 23, 2019
Recently, I was creating an event registration Webform. I created a custom composite field with the fields needed for each registrant: first name, last name, and a set of three radio options for their organization status: member, non-member, membership fee included in event registration. Each status has a different registration fee.
I then wanted to create a computed Twig field that would…
Continue reading Calculate a value from options field in Webform custom composite element with Twig - Drupal 8
June 7, 2019
A common pattern for websites is a list of content, for example news, with one (or more) featured items, followed by a list of a few more items, excluding the featured one(s). This seems like it should be simple to do, but it's not as straightforward as it seems.
Here's an example of how to achieve it with Views in Drupal 8. There are many ways of flagging featured content. In this case, we want…
Continue reading How to create a View with a featured item and a list that excludes the featured item, Drupal 8
May 21, 2019
I've been working on a site with events, and tearing my hair out over how to print formatted dates with the correct timezone value in Twig templates, specifically node.html.twig and views-view-fields.html.twig.
The issue was first, getting the formatted date to display in the template; and secondly, when I managed to get it displaying, it was not in the correct timezone; it was off by several…
Continue reading Print formatted date with correct timezone from datetime or daterange field in node and Views templates - Drupal 8
May 17, 2019
I'm working on a website which has icons on file upload links, like so:
This works for people who can see the icons, but what about those who can't? Accessibility means giving all users an equivalent experience, regardless of how they're accessing the site.
If the icons were inline images, we could add alt text with the filetype. However, in this case, they're background images.
So, we want to…
Continue reading Add file type indicator to file field links for accessibility - Drupal 8