Questions tagged [views]

The Views module allows creating lists of entities with a flexible query builder.

Filter by
Sorted by
Tagged with
1 vote
1 answer
84 views

How to show terms with a specific depth as exposed filter

I would like, on Drupal 9, to show in a view as exposed filter a taxonomy term with depth 0, one with level one (the children) and one with level 2 (level one's children). Basically I have a content ...
  • 103
0 votes
1 answer
63 views

Proactively rebuild view cache

I have a view that takes a while to build when the cache is cold (around 11s). When the cache is hot, the view loads quickly, of course (around 100ms). I'm using tag-based caching for this view, so ...
0 votes
1 answer
41 views

How do I override the template file of a view so that it no longer displays links in my view, but only the plain text?

How do I override the template file of a view so that it no longer displays links in my view, but only the plain text? This is a body field where the titles of the refenced entities are displayed as ...
1 vote
0 answers
15 views

How do I make an exposed drop-down filter filter on a grouped set of date fields?

We have a Drupal 9 View of nodes that have a date field. The node dates will all be for a particular day for one specific week (for an event). We have the View formatted set to group the dates and ...
  • 1,069
0 votes
0 answers
6 views

Group rows by date

In a custom view, I have some values which belong to the same month (06/2022). If I have some other data, they will be also displayed (before or after the 06/2022) How can I change the configuration ...
  • 79
0 votes
1 answer
244 views

How to render a custom block with variables from another custom block twig template

I have a custom block with some values I can access in the template of that block, for example the product_type variable. In the same template file I'm adding another view block with {{ drupal_block('...
1 vote
0 answers
31 views

When I add a particular field, the preview disappears. Why?

I have a Drupal 9 view which shows the fields of a particular content type. This content type has a particular field, ver. When I add this field in the view, the preview disappears and I get this ...
0 votes
0 answers
16 views

Grouped Date Filter - Offsetting by time of day

So I have a date field in an Order content type, and a view including an exposed grouped filter for a Date with buttons for early morning, mid-morning, noon, etc. I need to modify this filter so that ...
0 votes
0 answers
31 views

How do I create a block that displays nodes related to the current page?

I have a taxonomy vocabulary (Tags) with the following terms. term 1 term 2 term 3 term 4 term 5 term 6 term 7 term 8 term 9 term 10 term 11 term 12 term 13 term 14 term 15 term 16 I have an ...
  • 11
0 votes
0 answers
25 views

Views: querying several fields and presenting aggregate values

I have a need to build a report that aggregates field values using sum and count. I am running into trouble though figuring out how to solve rows that don't map at a field. For one, the table headers (...
  • 27.1k
0 votes
0 answers
49 views

How to get the multiple fields values update in one field on view page

i am creating one preprocess_views_view_field for specifc one field.I have 2 fields file name and news link. while need to change or get the those values are pass to field_link_text. I cant achive it ...
0 votes
0 answers
86 views

How to display nodes that belong to the same taxonomy term as the current page?

I created a "Categories" taxonomy vocabulary with the following terms and child terms : - Crypto -- Binance -- Ledger -- Metamask - Geek -- Security -- Apple ... The "tags" ...
  • 25
0 votes
0 answers
34 views

Programatically added custom fields don't show up

I'm adding new fields to views through a custom module. When I open the view page UI, the field is not shown. However, If I edit the view from the user interface, and click on Add field, the custom ...
  • 351
0 votes
1 answer
25 views

Add custom actions

In our website, I created a webform to allow users to ask for permission to purchase items; then, I created a view to show a table of records with the values in the fields contained in the webform ...
1 vote
1 answer
31 views

Persist query string arguments across all links in a particular menu?

I have a menu "Display Style Switcher" which has two links: Map, and List. You click Map, you get the Map display of search results, and if you click List you get the list display of search ...
0 votes
2 answers
216 views

CSS in custom module not loading

I'm trying to load a css file in a custom module, to style a template file I'm rendering. I followed the basic steps: global-styling: version: 1.0 css: layout: css/rr_users.css: {} ...
0 votes
1 answer
67 views

How to display in a block the media used in a node?

On my Drupal 9 installation, I created nodes with Media images integrated with CKEditor. This is not an image field in the node type, but an image embedded in node content with Media and CKEditor. How ...
0 votes
0 answers
62 views

Filter criteria field Timestamp value <= now

is it possible to filter a timestamp field against 'now' or 'today' value. it works very well with any Date field but i can't make it with a timestamp. the timestamp filter works if i put avalue of ...
0 votes
1 answer
229 views

Change weight/order of exposed filters

I have a view with two exposed filters: one generated using the Views UI, and another filter from custom code. Can I change the order in which the exposed filters are rendered on the form? I could not ...
  • 11
0 votes
0 answers
15 views

Paginate unformatted view

I would like to just render the {{pager}} variable inside a views-view-unformmatted twig template, but the variable seems to be only available for formatted views. Which is the easiest way to do the ...
  • 11
0 votes
1 answer
166 views

How do I use hook_preprocess_views_view_unformatted()?

I'm trying to use hook_preprocess_views_view_unformatted() on a Drupal 9 website. I tried to put very simple command into the function in mytheme.theme and in a custom module; unfortunately it didn't ...
0 votes
0 answers
11 views

Hide only one field from view for empty contextual filter

I have a view with the following structure: Here's the response in close-up: My requirement is to hide thecontent field for an empty contextual filter value i.e when we call /sync/newslist. The ...
0 votes
0 answers
42 views

How to group some exposed filters in a collapsible block

I have a view with several exposed filters The theme is based on bootstrap, so I'm looking for a way to group some of them within a collapsible or accordion block (Bootstrap example) I'd like to avoid ...
0 votes
0 answers
175 views

Custom Views Field Plugin

I am creating a custom views field plugin, and I am having a huge amount of notices in the dblog that I cannot trace. It's a simple views field plugin that just renders some content into a custom &...
  • 161
0 votes
0 answers
43 views

Filter date/time from date-range picker

I have a content type with a Date-range field; the default output in the view gives me, for example, Saturday, June 4, 2022 - 16:30 - Saturday, June 4, 2022 - 19:00. What I would like to show is ...
  • 199
0 votes
0 answers
100 views

How do i list all child terms that share the same parent term? But on "child term" page?

Let's say I have the following taxonomy (a 3-level hierarchy). Acura Integra Hatchback 1991 Hatchback 1995 Hatchback 2000 If I am on the last term of this hierarchy, for example Hatchback 1991, ...
  • 169
1 vote
1 answer
197 views

Use path alias as contextual filter

I have nodes in Drupal for News Articles that generates this automatic URL alias. I also have a view for News nodes. This is the data. The problem is that I can't use Content: Path (url) or Content:...
0 votes
1 answer
37 views

Render a fulltext exposed search bar separate from the rest of the filters

I would like to render my exposed fulltext search bar in a separate location from the rest of my search filters. My other exposed search filters are things like display number, sort order, etc... I am ...
0 votes
0 answers
219 views

display paragraph field in a view

I am trying to display my paragraph bundle fields in a view. is that possible? I have a bundle that contains 2 fields with no input limit. I want to display one of the fields in a view. I added a ...
0 votes
1 answer
67 views

Programmatically create result row in views

I have created a bunch of content types. Since I am using Drupal only for displaying results fetched from another service I was wondering if there is a way to display results in a view without ...
0 votes
0 answers
80 views

How to get PHP code into a Views Filter

I have a text field which is extracted from photo's EXIF value; its value is similar to 2021-05-31T15:15:05. I want to create a view, use the filter and get the field added in. However, I can't use ...
0 votes
2 answers
86 views

How do I print an exposed filter block in a template file?

I have a view with an exposed taxonomy filter. I configured it to be displayed as a separate block so that I can print it another twig template. I tried this. /** * Implements hook_preprocess_block() ...
  • 848
1 vote
1 answer
92 views

How to remove a sort in hook_views_query_alter

I've got a search API search view that has two sorts on it. relevance and then published date. This means that when I do a text search the relevancy score handles the sorting, but when there is no ...
  • 1,329
0 votes
0 answers
22 views

How do I get coupons usage in a view

There is no field for the number of times the coupon was used in Add fields when creating a new view. while other related fields such as Usage limit are available, according to database check: The ...
0 votes
0 answers
25 views

Filter or sort Multivalue Field of referenced Media items to their boolean field

I have a list of users who can add audios to their profiles via an multi-value entity reference field. The media/audio has an additional Boolean field to check if it's a primary or normal audio. In a ...
0 votes
0 answers
10 views

Views exposed filter on multiple references

I have a site built with domain_access and quiz modules. I have a content type Page and quizzes. Both the Page and Quiz share two taxonomies (theme and category), and ofcourse domain reference. I have ...
0 votes
0 answers
13 views

Results from "end date" in date range excluded from Views results [duplicate]

I have a view of Commerce orders, and I need to add an exposed filter to filter the orders by date range. I have added two exposed filters for Order: Placed. One filter is "greater than or equal ...
  • 1,234
0 votes
0 answers
37 views

Unformatted Views mutliple taxonomy terms

I apologize if it's an obvious question and I'm fairly new to twig and drupal. I'm trying to get the all the taxonomy term selected on the field field_delivered_on_behalf_of in views-unformatted twig ...
0 votes
1 answer
278 views

Run into issues with Drush after updating from 8.9.20 to 9.3.13

I upgraded from 8.9.20 to 9.3.13 and i did an update.php after this. I do get an error: MISSING UPDATES FOR: VIEWS The installed version of the Views module is too old to update. Update to a version ...
0 votes
0 answers
60 views

Title field returning &#039; where apostrophe should be?

I have a series of fields on a View. For some reason, any node title field with an apostrophe in it is being returned to my endpoint as Jen&#039;s Cupcake Store instead of Jenn's Cupcake Store. ...
  • 239
0 votes
1 answer
69 views

How to pass Block ID to a view?

I have a Custom Block type called HomeBlocks. This bundle has a paragraphs field which allows multiple paragraphs. I then place (using Layout Builder) an instance of this block type on my home page (a ...
  • 1,007
0 votes
1 answer
211 views

View data export with custom table doesn't work if user is not admin

I'm working on a Drupal 9 website displaying custom table data and I need to provide CSV/XLS export links for it. For the moment, I've defined a view consuming the custom table data thanks to the ...
  • 1
-2 votes
1 answer
39 views

How to create a custom layout with for a view, I have tried to print the fields but nothing works I created the template but cant display rows

I have a view in drupal 7 but I cant show up the rows, I created a template for the row-style-output but nothing happen. <?php /** * @file * Default simple view template to all the fields as a ...
0 votes
1 answer
22 views

How do I grab a field from a referenced item in views?

I currently have a view block called Offerings that shows up on all my Course content-type pages that display all the offerings for the said course. These offerings are their own content type called ...
0 votes
0 answers
24 views

Views contextual filter, can you add more than one 'has taxonomy term' with different validation/share rules?

I have a View that grabs the current node, and looks at taxonomy on the node page as a contextual filter argument. I want one vocabulary to require shares any terms (OR), and I want another to share ...
  • 27.1k
0 votes
1 answer
158 views

Help with Views Field Plugin

I am trying to make a views field plugin that provides some additional functionality to a field for me. I am having issues with it. I have an entity type called an lms_request. It has numerous bundles ...
  • 161
0 votes
1 answer
63 views

Related content by taxonomy term but using a relationship between terms

There are many posts and tutorials for creating views with contextual filters to display content that shares the same taxonomy term, but my requirement is slightly different. I want to create a view ...
1 vote
0 answers
83 views

View with a path of api/VERSION/foo/bar/%node - %node is not being upcast to a Node object

I am trying to create a handful of Views with a REST Export display. They have paths set behind 'api/.../.../.../%node' where %node will be an ID sent to the request to be upcasted. The basic View has ...
  • 27.1k
0 votes
1 answer
191 views

How can I access row field values in the parent views template?

In views-view-fields--myview.html.twig I can print a views fully formatted/rewritten field with a variable like: {{ fields.field_my_view_field.content }}. I am wondering if there is some way to print ...
  • 1,007
1 vote
1 answer
44 views

Create a Context/Condition and get a view display used on the page

I want to create a context/condition plugin that checks the total results returned from a view display on the page (its a block), and if its less/greater than a certain figure, hide certain peripheral ...
  • 27.1k