Questions tagged [views]
The Views module allows creating lists of entities with a flexible query builder.
15,174
questions
0
votes
0
answers
41
views
View preview not showing after core upgrade to 10.1.2
After performing Drupal core upgrade to 10.1.2 from 9.5.9 can not able to see preview in the rest export nested view.
Received the error as specified in the screenshot , also updating the error ...
1
vote
0
answers
9
views
How can I add the hero section image in the View to REST_API?
Hello im using Drupal 9.5.9 version. How can I add the hero section image in the View to REST_API?
I have created an api with Rest_API to fetch data from Views I have created. I have no problem ...
0
votes
0
answers
39
views
Custom view page for unformatted list
I have a view (Values_culture) and I set up the views-view-unformatted--values_culture.html.twig file as template for that view. In my case, the template is not detected, or the template does not ...
0
votes
0
answers
17
views
Display fields from entity reference revision, without indexing them
Scenario (simplified)
A content type with a number of fields.
One of the fields is (optional) single-value entity reference revision, pointing to a custom entity type with more fields. There are 3-4 ...
0
votes
0
answers
14
views
View Rest Export includes comments in json
View Rest Export returns a JSON with comments. How can I disable comments?
0
votes
1
answer
50
views
Custom datetime field is treated as a string in Views when filtering
I have added a datetime field using BaseFieldDefinition::create() to my custom entity:
BaseFieldDefinition::create('datetime')
->setLabel(t('Target date'))
->setCardinality(1)
...
0
votes
0
answers
18
views
Show field in a Views row as selected in the option for a custom Views Formatter
I have created a custom Views formatter to make an accordion. Each accordion item is a row. I added a custom field for the user to select which field would be used for the title of the accordion item.
...
1
vote
1
answer
97
views
Views Data Export: Plaintext field contains HTML entities
I have a CSV export which is done by the "views_data_export" module. When exporting, a plain text field which contains a double quote ends up with a " HTML entitity in the CSV file. ...
0
votes
1
answer
30
views
Why does content disappear for logged in users?
I have two examples of this. One, I'm using the Umami demo profile, and the pre-header language selector disappears for the logged-in user. I would like the language selector to be visible at all ...
0
votes
1
answer
78
views
in hook_views_pre_render, how to get the current display of the ViewExecutable
I have this code:
function my_module_views_pre_render(\Drupal\views\ViewExecutable $view) {
if (isset($view) && $view->storage->id() == 'myview') {
// Do something.
}
}
This ...
0
votes
1
answer
34
views
How can I display @total in view display rest export in json format?
In a block or page display view i can put Result Summary @total in header. But in rest export display view does not use header plugins.
How can i get @total in rest export json format?
I have search ...
0
votes
0
answers
14
views
How to filter webform nodes with a contextual filter that restricts webforms to those which have not been answered
I have a webform node display page that shows webform nodes that are available to individual users. Individual user accounts have a field called Project which has a Project name. This allows users to ...
-1
votes
1
answer
24
views
View with reference entity type
I have a View entity reference type and I want to get the fields along with fields I m using relationship Field to cal referenced type entities
I have content type with name product
Field 1: title
...
0
votes
1
answer
18
views
How do I aggregate the number of posts for each selection of a specific field?
Background
I have a custom content type "Change Request" that has an "Urgency" field which is a list with three options to choose from:
Low (3 or more days)
Medium (Less than 3 ...
0
votes
1
answer
31
views
Why is my pie chart showing multiple labels and incorrect count?
Background
I have a site where users can submit change requests. I created a custom content type "Change Request" which has numerous fields in it, some of which I want to generate charts for....
-1
votes
1
answer
80
views
jQuery selector does not find the view content after document.ready event
I am applying some jQuery to make a slick carousel from a Drupal view.
The carrousel does not work erratically on page load; sometimes, it does, sometime it doesn't.
jQuery(($) => {
$(document)....
0
votes
0
answers
59
views
Paragraph field in view relationship
Created a paragraph type with field named "related literature paragraph" as entity reference and inserted this paragraph type to a content type called landing page for a field named body ...
0
votes
0
answers
43
views
Alphabetically sorting by taxonomy name
I have a content type with a taxonomy term entity reference tagged to it. I am trying to make a view that lists all nodes of this content type but I want the sorting to be alphabetical based on the ...
0
votes
0
answers
21
views
Counting by rewritten element
In my view, I'd like to group my row by values.
The initial data look like this.
In the field configuration in the view, I rewrite each value like this {{ field__value |split('-')[2] }} to get only ...
0
votes
1
answer
30
views
How to prevent empty field wrapper from rendering in views
In views I display fields for specific content types. One field is referenced to taxonomy term. Not every node has the term reference. I need to style this field with paddings and colours so I would ...
0
votes
0
answers
22
views
How can I combine filter values?
I'm on D9.5.x.
I'm styling the default Glossary view. It works, but on the site some of the node titles start with a character that is not alphabetic, for example - My awesome title - or @ My Work. ...
2
votes
2
answers
156
views
Deleting entities using Batch API without a form or user interface
In a custom Drupal 9 module, I need to delete entities using Batch API without a form or user interface. The list of entity IDs are generated and the batch is built in hook_views_post_execute(). When ...
0
votes
1
answer
35
views
Fetch the total number of rows in Rules View to use that number in Rules
I have a View that lists entity IDs of some sort and I have created a Rules View for this. In Rules, I have created a component where I want to fetch the total number of rows from that Rules View and ...
0
votes
0
answers
16
views
How to expose a filter of an list (text) field to your site visitors in a REST Export View
How can I filter based on selections of a list (text) field and share that with users? For text fields this works out of the box, but for list fields you can only select the specified values:
I would ...
1
vote
0
answers
50
views
Filter content depending on user access
In Drupal 10, I use the Permissions by Term module to restrict user's access to content depending on dictionary values.
I have a content view that does not respect the access permission given by that ...
0
votes
0
answers
25
views
How to override views-exposed-form in a module?
I'm trying to override views-exposed-form. It works fine in a theme, but it's strange in a module. Eventually, it does find the template, but the form is available as {{ element }} and is missing the ...
0
votes
1
answer
38
views
How to use a view mode for all the content entities
I would like all the nodes for the "Services" content type to use the "Demo" view mode.
Structure -> Content type > Services > Manage Display tab shows 3 view modes: ...
0
votes
0
answers
49
views
How to send notification emails to users who flagged a node?
I want to notification email users who flagged a node.
Previously in Drupal 7, there was Views Rules which is used to get flagger email and loop on them to send message.
Since Views Rules has no 8/9/...
0
votes
0
answers
26
views
How to add/insert a value to the end of an array programmatically (in the .theme file) Add a $row
I have some code in the .theme file that renders an array list. I wish to add one additional entry at the end.
I found I could do that with a quick and dirty PHP echo statement, and it works just ...
0
votes
1
answer
325
views
How do I disable ONLY_FULL_GROUP_BY in MySQL 8?
Is it possible to disable ONLY_FULL_GROUP_BY in MySQL 8?
I saw suggestions on how to do this on the MySQL server directly, as well as hacking up Drupal core, but none of them have been successful so ...
0
votes
1
answer
42
views
"Most popular" tags of the day
How can I create a list of the most popular tags of the day, based on the actual date, using view?
The most voted answer for Most popular tags in a list as a block helped me to set a list of the "...
0
votes
1
answer
22
views
Cascade dropdown list aka dependent dropdown list
Is there any way to make a cascade dropdown list aka dependent dropdown list for a "survey" content type?
Apart from the "survey" content type. I have three other content types: ...
0
votes
0
answers
22
views
How to add a relationship in google analytics reports views?
So I created a custom module and added a .inc file. Inside that file I've defined a hook_views_data() in which I have defined content entity relationship so that it supports GA reports.
Code in .inc ...
0
votes
0
answers
34
views
Updated/commented date - display permission problem
I'm trying to get a Comment Statistics (category) - Updated/commented date field {{ last_updated }} which is a date formatted field to be visible to everyone including anonymous users.
The view access ...
1
vote
0
answers
29
views
Caching Views with altered query
I have a view showing on taxonomy terms which shows popular nodes from same category of taxonomy terms.
Category - Taxonomy Terms - Nodes
Lets say Term A and Term B both are same category. On Term A ...
0
votes
0
answers
18
views
How to write a custom action in Views VBO to print a batch of selected invoices
I need a custom action in Views VBO with Drupal Commerce to print a selected group of invoices to a browser print dialog. I have configured this as a src plugin and a custom twig template. Here is an ...
0
votes
1
answer
107
views
Turn off caching for local tasks menu
I have a somewhat complicated view that uses multiple displays for showing events. It uses a datepager (https://www.drupal.org/project/date_pager), exposed filters (using better exposed filters), and ...
1
vote
3
answers
396
views
How can I modify a field using PHP code in "rewrite results"?
Drupal 9.49
PHP 8.0
Views 9.49
I am returning the title field in a view. The title being returned is "XYZ Aberdeen".
I want it to simply return "Aberdeen"
When I click on "...
0
votes
1
answer
118
views
How to Sort Views results based on two fields
I have a view that lists nodes of type Article. Each Article includes a boolean field and a date field. Neither field is required. I want to sort the list of articles so that the first articles are ...
0
votes
1
answer
125
views
Why does twig tweak's drupal_field() function convert special characters to HTML entities?
I'm using the following inside views to change the page title to the term name but it renders term names with & in them as &
In the views override title section I'm using.
{{ drupal_field('...
0
votes
1
answer
71
views
Programmatically remove duplicated nodes without changing the number of nodes shown per page
I have a content type called Página de área (Area page) referenced by two content type: Article and Agrupador. I have a view that displays all the Article nodes that share at least one area with an ...
0
votes
0
answers
29
views
Is there any way to show the data fields from content and google analytics reports in view page?
I want to create a view page where I can show/add the fields of content (title, author, content type, etc) and also the fields of google analytics reports api (event name, total views, users, etc.) I ...
0
votes
0
answers
16
views
target separate fields of my taxonomy term in my view using twig
I have a view displaying taxonomy terms as fields by making use of a responsive grid. I have a twig file based on views-view-grid-responsive.html.twig.
in this twig file there is a loop {% for item in ...
0
votes
0
answers
48
views
How to add a confirmation form to an advanced configurable action?
So far I successfully implemented an advanced action (in a custom module) by extending ConfigurableActionBase and implementing ContainerFactoryPluginInterface. As expected, it appears listed in /admin/...
1
vote
0
answers
28
views
Excluding some taxonomy terms from a view when grouped by taxonomy
For node type 'people' I have tags A, B, C etc. Some people have multiple tags.
On my view I'm grouping them by taxonomy term and selecting A,B,C,D etc under 'Select terms from vocabulary People type' ...
1
vote
0
answers
21
views
How to output file upload date (of a file field) in a JSON-view?
I have rest_export view to generate json output of nodes.
I'm trying to output a the upload date of files in a multivalue filefield, but can't find a solution.
I tried to use the "rewrite results&...
1
vote
1
answer
37
views
Can a view be accessed if there's no page or block?
The following question may seem contrived, but I have custom access controls besides roles and permissions, so I can place view blocks on pages that are viewable by users in a list, for example.
If I ...
1
vote
0
answers
39
views
Find content with missing entity reference
I have nodes that have embedded Media (images) and also links to other content (nodes and media). Through hooks I populate custom fields to store those references, this is a multi-value entity ...
0
votes
1
answer
34
views
Report of coupon and users
I have users who are partners and users who are clients. When clients submit an order, they use a custom coupon code associated with each partner. (Each partner has a Mycodes field set within their ...
1
vote
0
answers
31
views
Filter only by existing nodes
I am trying to get a view to have only a selective range of referenced content, (somewhat like https://www.seek.co.nz Classification filter) in its exposed filter, but not having any joy so far.
This ...