Theme colour switcher

Blog Topic: Views

Please note I'm not referring here to showing a block with a list of content that shares the same taxonomy terms as the content it is displayed on, a.k.a. a "related content" block. There are reams and reams of tutorials out there showing you how to do that. This use case is when you have a specific block, maybe just some custom output, that you only want to show on content that is tagged with…

Continue reading How to show a Drupal block on content tagged with specific taxonomy terms

Background: I work on a site with different groups of users, to manage which we use not only core Drupal roles and permissions, but the Group module. Recently the site owner requested to add a Workflow to a content type. Clients need to be able to see the workflow state and change it, but not be able to see or edit the original node, or even the workflow tab on the node. We manage client access…

Continue reading Allow users to update an entity's Workflow status from a Drupal view

Recently I discovered an odd Drupal Views bug. While testing a view I realized that content it should have shown was missing from one display. After a lot of testing, it turned out it was due to two relationships to content in entity reference fields on the content type my view displays. These fields were empty in the missing nodes. Removing the relationships or adding content to those fields…

Continue reading Drupal views doesn't show content if entity reference field relationship is empty

Previously, I posted about how to create a view on a user's profile of content authored by that user, limited to content in Group(s) the viewing user is a member of. That tutorial shows how to accomplish that with a view of content (Drupal nodes) which are in Groups. The person who requested that tutorial later told me they needed a view of Group content. Group content is the relationship between…

Continue reading Show group content on author's user profile, limited by viewing user's Group membership - Drupal 8 & 9

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

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

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

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

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

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