Questions tagged [views]

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

Filter by
Sorted by
Tagged with
-1
votes
1answer
9 views

How to make a listing page of contents without using UI

I'm currently trying to make a Drupal 8 site that will show a list of actors with their image, description, and rating. I have already done so using the drupal UI itself but I want to achieve the same ...
0
votes
0answers
19 views

How to hide body field in a view only on certain content types

I have a search result view of different content types, and i want to show the body field (trimmed) on some content types, but show no body on other content types. Since they all share the same body ...
-2
votes
0answers
20 views

Toggle button to switch between roles

I am working on a site where there are 2 roles. creator Approver A person approved to Creator role will be seeing only that content. Similarly a person who is having approver role will only see ...
0
votes
0answers
18 views

Twig alter replacement patterns / rewrite results views field

I have some text I'd like to alter in the custom output of a views field. For example, if the output contains the word "pancakes" I'd like to replace it with "waffles". {{ field_recipe_prep__value ...
-2
votes
0answers
11 views

Using if else statement in Views “FILTER CRITERIA”

I added a field "isFirst" type Boolean to content type "Publication". I create a block that display just the latest one publication that its field (isFirst == true). I want that the block display the ...
0
votes
0answers
15 views

How to get block relationships in a Views content type? (3 references in a Views)

As part of a migration from drupal 7 to drupal 8, I currently have a rather original node display method that I'm trying to reproduce to Drupal 8, but without success. Currently on Drupal 7, this ...
0
votes
0answers
13 views

Group paragraph fields in Views

I've added the paragraphs field as a relationship and managed to add my fields to the view but I can't seem to group them together. As a result the node entity is being spit out twice. Is it possible ...
0
votes
0answers
15 views

When the view has no result with the paragraphs, there is an error

I created a view to display a block on my store page. But my page displays an error when the view has no result. If the view has a result, it works. What's the problem ? When I go to my store page, I ...
-2
votes
0answers
11 views

Show a list of tagged node based on entity reference field [duplicate]

Drupal 7 Taxonomy vocabulary = Company activity (Activity 1, Activity 2, Activity 3 ….). This vocabulary has an OG group field. Content type 1 = Company with an entity (terms) reference field ...
0
votes
0answers
12 views

How do I set granularity to an END date value used as sort criteria?

I have a Date field with start and end dates (mm-dd-yy). I need to build a View listing nodes grouped by end date year and sorted first by descending end date year and second by ascending title. ...
0
votes
0answers
20 views

Custom node access control not working with access filter?

In some of mine content types I have checkbox field "Content protect". If checked that node should be visible only to registered user. If not checked - visible to everyone: function hook_node_access($...
0
votes
1answer
19 views

Programatically change exposed filter value based on another exposed filter

I have 2 exposed filters in my Drupal 8 view - both are select dropdowns. I want the value of the 2nd filter to change based on selection of first filter Here are the filters $filters = $view->...
0
votes
1answer
28 views

Programmatically creating a custom block

I followed the steps from https://www.webwash.net/programmatically-create-block-drupal-8/. I have a view already created and I want to render this view in this block. I can't find a good ...
-1
votes
0answers
22 views

How to load a JavaScript function during view load?

I have a view called 'Programs search'. I want to disable certain fields based on javascript function during the page load. I already have a custom.js script created. Not sure what should be the ...
-1
votes
0answers
14 views

Select several pdf anywhere on website to add to cart and download them all by providing email [closed]

I use drupal 8. I have been searching all over the internet for a solution, but I cannot find any. This is my last resort before quitting on drupal and trying another CMS. I have a website (not an e-...
0
votes
1answer
11 views

Hiding view filter option based on another filter selection

I have a view with search criteria and the search criteria looks like below: Age group(options: new born, toddler, pre-school) Classroom (options: NA, potty-trained, transition, not-trained) All ...
0
votes
1answer
16 views

How to get replacement pattern for Search API's fulltext search in global text area header

In Drupal 7, I'm currently using the default core search, and a view for node search results. I have a global text to pull in the replacement pattern for the term that were searched for. I get the ...
1
vote
1answer
20 views

Views alter changes next row instead of current one

I have a view that is showing event content types. Users can apply for these events. I am using a hook to alter the 'view applicants' so I can show how many applications already excist. The ...
0
votes
0answers
9 views

Views Data Export - Exporting a Referenced Media Item's URL

I need to create an Export to CSV from a series of pieces of content. Each piece of content uses a media field that I am trying to reference. The rest of the fields export fine, but I am unable to ...
0
votes
1answer
24 views

Filter nodes by today's date

Following what described in Views filter criteria date field is greater than current date, I have used operator >= today with some success. I would like to create "future" nodes and they should be ...
0
votes
1answer
16 views

PHP query in a view will cause website error

I'm using a global PHP query in a View to find out the count of membership users. The first query, that extracts the total number of users from the database works fine, but when I use the WHERE clause ...
0
votes
0answers
17 views

unknown Ajax call on custom views_exposed_filters while changing dropdown list

I have two exposed filters as select fields (County and District) using Hook_form_ID_alter. I'd like to alter the #options of District base on the County I selected to display related options. But ...
0
votes
0answers
22 views

get view id in hook_preprocess_html() drupal 8 [closed]

To get the view id in hook_preprocess_html() function hook_preprocess_html(&$variables) { $route = \Drupal::routeMatch()->getRouteObject(); if ($route) { $view_id = $route->...
0
votes
0answers
33 views

Print a taxonomy term and url D8 views template

I am totally new to drupal 8. I have used d7 and i am migrating now. I have setup a view with 4 articles. I have managed to print out in a custom views theme my title image url {% for row in ...
0
votes
0answers
11 views

Contextual filter for month and day

I have created a block that lists all the users () that are years old that same day. The problem is that when I want to add a contextual filter that compares the birth_date field with the current ...
-1
votes
0answers
23 views

Content “stream” with manual placements

We have a requirement for a new project: on the homepage there should be a infinite (load more button) "stream" / list of content teasers sorted by published date the complicated part: it should be ...
0
votes
1answer
73 views

hook_views_post_execute() don't work on AJAX View with exposed filters after 1st refresh

I have a View which returns 5 entities of the same type. AJAX - enabled, filters and exposed filters, all working fine. I need to add a new result, a user - defined entity, at the top of the View ...
0
votes
0answers
32 views

How to call rest api in Drupal8 After form submit

I created one internal api call as '/api/v1/user/promotional-emails' this api calls some external apis and we are updating data there. In postman api is working fine. Now i created a user form as '/...
0
votes
0answers
10 views

Are there any solutions that integrates custom mysql datetime field with views?

I created my own table with a mysql datetime field via hook_schema. The code that defined the field is here 'timestamp' => [ 'description' => 'The timestamp value when the recipient ...
0
votes
0answers
25 views

Setting Views contextual filter values dynamically with Twig in Webform

I am attempting to embed a view in a webform whose contextual filter value is set based on a user selection. I have created a view of nodes with a contextual filter, and a webform with a select ...
0
votes
0answers
6 views

Drupal 7, views, organic groups, how to create a view of groups user belongs to and what their role is

I have built a view following this link Using Views to List a Member's Organic Groups (7.x-2.3) It list the groups the current user has subscribed to. I have been trying to also add a field ...
0
votes
0answers
5 views

Display only the variations of a specific product when I create a new content

I'm working on a videogame website. I use Drupal Commerce with Druapl 8 to manage games. For example : (Sonic the Hedgehog) is the Product, and (Mega Drive - EUR) and (Mega Drive - JPN) are the ...
0
votes
1answer
15 views

How to get bundle machine name when viewing the creation form?

From the creation form (any bundle), I need to get the content type label/name to use it in a link (in a block, for example) and pre-filter the View opened by this link. Example : The user wants to ...
0
votes
0answers
11 views

Multistep sign up, force user to create node before they can access site?

Im using Drupal 7. I want my users to either create a node or flag a node before that can access the rest of the site. I have created a view of content, and added filter either current user is node ...
1
vote
1answer
21 views

Splitting exposed form filters amongst several blocks

I have a views search page in D8 where I'm I have exposed filters that are shown in blocks. I'm also using search facet blocks. What I want in the sidebar is the exposed filter text search field, ...
0
votes
0answers
17 views

Is it possible to alter a field value in a Views filter handler? [duplicate]

I have a custom Views filter handler where I need to alter the field value within it. The filter is for a date field in the table that uses a non-standard date format and I need to change the value ...
0
votes
0answers
10 views

Sort tags in a view by the number of content they are displayed in

I'm trying to make a view that would display only name of tags and the number of content that uses that tag. I have managed to do this following this tutorial: https://www.youtube.com/watch?v=...
0
votes
0answers
20 views

Custom entity's exposed node reference filter

I have created a custom Entity using drupal generate:entity:content. This works great overal: I can use it in my code like I want. One of the table columns of the entity is a node-reference. This ...
0
votes
1answer
32 views

how cache a view that has a field that is calculated on the fly

in a view, one field has the following computed value, which takes a lot of time to return results from the database: <?php $term = taxonomy_term_load($data->tid); print ...
0
votes
0answers
22 views

Create specific view for all categories

I have a list of Categories defined that all have specific URL aliases defined. I'm trying to set up views for those specific feeds. For example, if I have categories cats, dogs, fish (with aliases /...
0
votes
1answer
23 views

How do I rewrite the way my view rows are displayed

I created a view and added three fields. A title, a link, and an image. When adding the image, I set the formatter as URL to image. How do I rewrite my in my views so that each recipe can have the ...
-1
votes
1answer
25 views

Get all the paragraphs of the current node programmatically in form_views_exposed_form_alter

I have a content type with multiple field paragraph. I would like to get all the paragraphs from the current node in form_views_exposed_form_alter. I tried $node = menu_get_object(); $storage = ...
0
votes
3answers
45 views

Override templates for one view page or block

I am trying to figure out if there is a way to override the base templates for one view. I created a page with a view called 'Promotions'. I need to override the views-view-field.html.twig, views-view-...
0
votes
3answers
61 views

Programmatically add cache max-age

I tried setting the cache max-age to 0 in hook_views_pre_view, in hook_views_pre_build and in hook_views_query_alter but it just doesn't work. Eg: function my_module_views_pre_build(ViewExecutable $...
-3
votes
0answers
17 views

How to create filters for product fields in Ubercart?

I have installed ubercart module in drupal 8. I want to display filters on ubercart catalog page. Please help me How to add filters on ubercart catalog page.
0
votes
0answers
19 views

How do I create a template to display view fields [duplicate]

I created a view and added it as a block. Now what I want to do is to manage the way the fields are displayed. However, when I inspect the page, twig doesn't show me a template name that I can use to ...
1
vote
1answer
11 views

View page not filtering content according to its language

I used devel to generate dummy content for a content type named recipe, and at the moment I have 10 recipes. 5 in English and 5 in Portuguese. I create a view(page view) that shows all the recipes ...
0
votes
0answers
20 views

Views: how list all nodes that have the same value for a field

I have a website which with different content-types to present recipes. The content types are as follows: - Recipe, contains a field 'ingredients' linking to: - Ingredients, contains a field '...
0
votes
0answers
26 views

Group id not shown when view is empty in Drupal 8?

I am new to Drupal 8. I make custom view field (programmatically) and pass session variable to it.Session variable contain group id. The problem is that when the view is empty i mean no content in ...
0
votes
0answers
26 views

Make a news item “sticky at the top of lists”

I want to sort my news items by sticky to the top and then date so I can highlight certain news items. The same question was asked here, the answer was to: "Just sort by sticky and after that sort ...

1
2 3 4 5
291