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
28 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 ...
user avatar
0 votes
2 answers
41 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: {} ...
user avatar
0 votes
1 answer
27 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 ...
user avatar
0 votes
0 answers
25 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 ...
user avatar
0 votes
1 answer
59 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 ...
user avatar
  • 11
0 votes
0 answers
7 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 ...
user avatar
  • 11
0 votes
1 answer
62 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 ...
user avatar
0 votes
0 answers
7 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 ...
user avatar
0 votes
0 answers
23 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 ...
user avatar
0 votes
0 answers
55 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 &...
user avatar
  • 161
0 votes
0 answers
25 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 ...
user avatar
  • 199
0 votes
0 answers
98 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, ...
user avatar
  • 169
1 vote
1 answer
71 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:...
user avatar
0 votes
1 answer
29 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 ...
user avatar
  • 323
0 votes
0 answers
42 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 ...
user avatar
0 votes
1 answer
29 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 ...
user avatar
0 votes
0 answers
55 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 ...
user avatar
0 votes
2 answers
32 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() ...
user avatar
  • 814
0 votes
0 answers
24 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 ...
user avatar
  • 1,279
0 votes
0 answers
19 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 ...
user avatar
0 votes
0 answers
19 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 ...
user avatar
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 ...
user avatar
0 votes
0 answers
11 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 ...
user avatar
  • 1,234
0 votes
0 answers
30 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 ...
user avatar
0 votes
1 answer
108 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 ...
user avatar
0 votes
0 answers
35 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. ...
user avatar
  • 239
0 votes
1 answer
40 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 ...
user avatar
  • 927
0 votes
1 answer
67 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 ...
user avatar
  • 1
-2 votes
1 answer
30 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 ...
user avatar
0 votes
1 answer
20 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 ...
user avatar
0 votes
0 answers
19 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 ...
user avatar
  • 26.8k
0 votes
1 answer
64 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 ...
user avatar
  • 161
0 votes
0 answers
28 views

Views user input custom global text

I use Views to generate some links so I can prepopulate a list of Webform links. In one field, it is a global custom text with a number and the second column is the webform link with a replacement ...
user avatar
  • 111
0 votes
1 answer
40 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 ...
user avatar
  • 67
1 vote
0 answers
71 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 ...
user avatar
  • 26.8k
0 votes
1 answer
68 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 ...
user avatar
  • 927
1 vote
0 answers
35 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 ...
user avatar
  • 26.8k
1 vote
1 answer
99 views

How to invoke a custom operation in Views

I have a View that lists some nodes. Each node instance has a boolean - "Spam" - that defaults to FALSE. In the view there is an "Operations" column where there shall be a link ...
user avatar
  • 14.8k
0 votes
0 answers
84 views

How to alter the end date views query for search api

I'm trying to alter an exposed date filter in a view I created that uses solr search api. I noticed that the end date filter doesn't work unless I add a day to the end date. so for example if i have ...
user avatar
  • 408
0 votes
1 answer
32 views

Any idea why exposed sort filters won't show up when configured correctly in D9.3 (works on simpletest.me instance)?

D9.3.12 I have a block view with sort criteria configured, but no exposed sort criteria show up in the preview or on the site when placed - "Exposed form in block: No" and "Use Ajax: ...
user avatar
  • 1
1 vote
0 answers
104 views

Programmatically set exposed filter not possible when also using contextual filter

I've got a view, that needs to set the default value for an exposed filter based on a user entity field. This basically works: function MYMODULE_views_pre_build(\Drupal\views\ViewExecutable $view) { ...
user avatar
  • 4,966
0 votes
2 answers
90 views

Which cache should I invalidate in a block plugin that builds render arrays for one or more views?

The real issue is that the plugin will sometimes be returning render arrays that are discrete block displays from the same view, possibly also with different arguments. What I'm discovering is that in ...
user avatar
  • 349
0 votes
0 answers
14 views

Show two unique exposed filters in different blocks for the same view

I have a view that has 3 exposed filters; two Taxonomy Terms and a Search Field. I want the two taxonomy terms to appear in the Left Sidebar and I would like the Search Field to appear above the ...
user avatar
  • 323
0 votes
0 answers
27 views

How do I prevent filtering of parent when adding a filter to a relationship?

I have a view of users which includes a relationship to a multi-value paragraph field. I’m adding a filter to the paragraph if field_current is set to true, to show only the current paragraph. But the ...
user avatar
  • 507
0 votes
0 answers
22 views

Limit view path to one domain

I currently have a Drupal 9 site running with Domain Access and a view with a relative path like contact. The site currently has two domains, linking the page to both domains like so: sub.domain.com/...
user avatar
  • 1
0 votes
0 answers
20 views

How do I selective limit Product Attribute values when using them as an Exposed Filter in a Product list View?

I'm using the Commerce module 2.x. What I have: Product Category taxonomy List of product categories Product Color product attribute List of product colors It has a Product Category entity reference ...
user avatar
  • 11
3 votes
2 answers
75 views

String substitution in Views Contextual filter parameter?

In Drupal 9, I have a View called News. The View is displayed at the following path: /news I can edit it at the following path: /admin/structure/views/view/news/edit It has the following Contextual ...
user avatar
  • 1,950
0 votes
0 answers
9 views

Date scroller for View

I would like to add a widget or a plugin which is a date scroller to a view page. The widget would be on the side of the view, showing the months of the nodes that are being viewed. So, lets say I ...
user avatar
0 votes
0 answers
9 views

Filter a view on whether the page has a menu link

I'd like to make a view listing all pages that do not have "Provide a Menu Link" checked so that I can review them for pages that would appropriately have a menu link to a parent page. I can'...
user avatar
1 vote
0 answers
39 views

Get all entities with more than one reference in a field

We have an entity type "mandate" which references to an entity "fraction membership". When a politician changes his fraction during an active mandate a new fraction membership ...
user avatar