October 24, 2020
See also how to do this with a view of Group content
Someone contacted me asking for help with the following:
I am trying to look at the particular user profile, and below that profile contains a stream of content nodes which I will be able to see only content created by that particular user in group that I am a member of.
Example. If A is a user who created 2 Group’s and has added me to one of…
Continue reading
Show content on author's user profile, limited by viewing user's Group membership - Drupal 8 & 9
October 23, 2020
I wanted to change the format of the comment submitted timestamp on my blog, and figured it could be done in Twig - but nope. There's an active issue on Drupal.org to allow the format to be changed in the UI, but until that's done, you need to use a theme preprocess function.
function THEMENAME_preprocess_comment(&$variables) { $date_formatter = \Drupal::service('date.formatter…
Continue reading
Change format of comment created date - Drupal 8 & 9
September 10, 2020
This is slightly adapted from presentation notes, so it's a bit sketchy. It's more of an outline of requirements, rather than code samples. I may add those later. Also, note that I've only covered two scenarios: a dropdown menu, and a menu that covers the entire screen when opened (modal dialog). There may be different considerations for other styles.
Mobile menu: usually the site's main menu,…
Continue reading
How to create an accessible mobile menu
August 4, 2020
By default you get the following page template suggestions for a Commerce product:
page--product--[ID].html.twig
page--product--%.html.twig
page--product.html.twig
page.html.twig
Here's a template suggestion for custom page templates per product type:
/** * Add page templates for Commerce product types * Example: page--product--event.html.twig *//** * Implements…
Continue reading
Drupal 8 theme suggestion for Commerce product page template per product type
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
or…
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.
Happy knitting!
Hatticus: Free Super Bulky Cabled Knit Hat Pattern (PDF)
Continue reading
Hatticus: Free super-bulky cabled knit hat pattern