Puncte:0

Listing articles that matches a specific set of filter criteria

drapel kz

I have a Drupal 9 site with three roles: Editor, Reviewer and Author.

I use the core Article content type, with one additional field: field_reviewer. It is an Entity Relation to the user that has been assigned the task of reviwing the Article.

Articles may be created by Editors (typically from an article submitted by an external Author), or by an Author that is already a user. Editors has full access to all Articles, and may assign a Reviewer to any Article in the system.

I want to show all roles a list that is called "MyArticles". This list should have the following filter criteria:

  1. Content type: Article; AND
  2. Have a Reviewer assigned; AND
  3. ( Be authored by the currently logged in user; OR
  4. The currently logged in user is the Reviewer. )

I've tried to create a View with these filter criteria, and have no problem creating a View that matches the two first criteria.

As for the third and fourth, I can:

  1. Create a View that is authored by the currently logged in user (using a relation).
  2. Create a View where the currently logged in user is the Reviwer (using a contextual filter).

But I am unable to make a View that combine the two. By default, it looks like a contextual filter by default uses an AND relation, so adding it excludes all nodes authored by the currently logged in user from the View.

I've tried to use the contribute module "Views Contextual Filters OR" https://www.drupal.org/project/views_contextual_filters_or

but I can't get it to work. It may have something to do with this bug report: https://www.drupal.org/project/views_contextual_filters_or/issues/3215441

Is generating the "MyArticles" list described above doable with Views?

If not, I am prepared to create a custom module for generating this list. I think I already know how to set up a dynamic SQL query for this in PHP, but what is the correct directory to place this PHP code. Will this be a "Controller", a "Form", a "Plugin", or something else?

PS: I know this can be resolved (sort of) by using the Workflow module, but I have other requirements (not mentioned in this question) that precludes use of the Workflow module for this, so I need to do it using Views or a custom module.

Postează un răspuns

Majoritatea oamenilor nu înțeleg că a pune multe întrebări deblochează învățarea și îmbunătățește legătura interpersonală. În studiile lui Alison, de exemplu, deși oamenii își puteau aminti cu exactitate câte întrebări au fost puse în conversațiile lor, ei nu au intuit legătura dintre întrebări și apreciere. În patru studii, în care participanții au fost implicați în conversații ei înșiși sau au citit transcrieri ale conversațiilor altora, oamenii au avut tendința să nu realizeze că întrebarea ar influența – sau ar fi influențat – nivelul de prietenie dintre conversatori.