Questions tagged [views]

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

Filter by
Sorted by
Tagged with
5 votes
5 answers
919 views

How to stop a Views block from displaying to administrators, such as user/1?

I created a view and put an access role of anonymous user. When I log in with normal user account I don't see it, but when I log in with my admin account I see the view. I would like to not see it. ...
user avatar
  • 29.7k
110 votes
2 answers
68k views

Contextual filters taxonomy name

I'm adding a contextual filter to a view for a custom content type that has a taxonomy field. The contextual filter allows me to filter by the taxonomy tag id but not by the taxonomy tag name. Meaning ...
user avatar
  • 1,243
34 votes
5 answers
32k views

Node count for taxonomy terms

How can I display the node count values for taxonomy terms with sorting the result list in descending order of node count?
user avatar
  • 5,289
14 votes
5 answers
20k views

Changing url of exposed filter

When I used an exposed filter the filter selection is passed as name/value pair in the url, for example: members?field_a=valuea&field_b=valueb How can I set it up to use more of a "pathauto" ...
user avatar
  • 11.9k
30 votes
9 answers
45k views

How do I remove duplicates when using the random sort?

I have created a view where I am displaying the the node title and a logo (a cck field). In the arguments I have passed the taxonomy term name. In the result a node is displaying 2 or 3 times; I ...
user avatar
  • 2,697
23 votes
4 answers
6k views

Clean way of building simple taxonomy browser of arbitrary depth

I have spent days trying to determine a clean way to do the following: Display a list of all top-level terms in a vocabulary with links to their child terms Upon clicking a link, be taken to a list ...
user avatar
  • 9,077
18 votes
9 answers
46k views

Create template file for views block

There is a lot about theming custom blocks, but what about blocks created by views? My views block has id: block-views-posts-listing-block, I try many ways for naming template file, ex: block--block-...
user avatar
  • 4,955
14 votes
3 answers
31k views

How to show the parent and child taxonomy term?

I have a vocabulary like this: Parent 1 Child 1 Child 2 Child 3 Parent 2 Child 1 Child 2 Now I would like to use a view to create a list of a Parent term with its Child terms. I try to do this ...
user avatar
1 vote
1 answer
393 views

How to show message view containing own and following activity?

I have created a message view using the Message module. I want this view to show the current user activity and activity of the user he is following using the "follow" flag (user). i.e own + following. ...
user avatar
  • 441
19 votes
1 answer
29k views

Contextual filter with a block view

I have a page view("/news") with contextual filter for the topics ("news/design","news/coding"...) which are taxonomy terms and this worked fine. Due to some changes for the mobile theming, I need a ...
user avatar
  • 191
8 votes
2 answers
6k views

Show node IDs along with titles in Entity reference Autocomplete list

I'll like to add this functionality to the autocomplete widget in Entityreference field to show node ID next to the titles in the dropdown list. The reason behind the idea is to differentiate between ...
user avatar
  • 81
3 votes
5 answers
3k views

How to bulk update select list fields?

I have a content type and it has a select list field. There are two options Yes or No and this field is not a required field. The website has about 100,000 nodes and I want to bulk update all nodes ...
user avatar
  • 2,132
8 votes
3 answers
448 views

Is there a more performant alternative than overriding template files?

I've got to get rid of a lot of unnecessary markup in a view. In general, I accomplish that by overriding the template files in my theme, but this time the view is really huge and performance is going ...
user avatar
9 votes
2 answers
15k views

How do I get a block to use a URL to configure a contextual filter?

Blocks do not have paths so how can I pass a context to the block to get the correct results for a page?
user avatar
  • 5,097
9 votes
3 answers
21k views

What is the purpose of Views "Attachment", "Content pane" & "Context"?

I've just made a Views for a content type. In one views, I need a page for the content type and a preview of 4 newest posts on the front page. Page is not the problem. For front page preview, I just ...
user avatar
  • 389
14 votes
4 answers
16k views

How to configure an exposed filter in a view using a date picker?

How can I configure an exposed filter so that users can filter my site content by creation date, preferably using a date picker? I tried using Content: Authored on as filter, but it gets me a text ...
user avatar
  • 357
4 votes
2 answers
3k views

Alter a Views query to use "OR" through the user interface

I have a view with a few different displays, each of them with slightly overridden filters, like this one used in a panel. How do you add this pseudocode via the UI? AND (node.type='story' OR node....
user avatar
  • 3,778
4 votes
3 answers
671 views

How to prevent access to Views-only content?

When I'm developing sites in Drupal, I create various content types and taxonomy vocabularies that I use with Views to build displays. I might not ever want the nodes to be viewable in their own right ...
user avatar
  • 1,843
-1 votes
4 answers
3k views

is it possible to have one views-view--VIEWNAME--page.tpl for multiple views?

I have 8 content types and 4 of them are the same and the difference is just their name. they all have a page view and the way I display them on screen is the same. instead of having 8 pages. (...
user avatar
  • 3,849
19 votes
2 answers
16k views

Using views with a custom table/schema

I need to set up some views that will pull some data from a custom table I created. Some views will need to pull content the regular way and from my custom table (where I may query for a particular ...
user avatar
  • 1,973
23 votes
4 answers
10k views

Are views cached through the core caching mechanisms or should I be setting the caching directly in each view?

I see there are cache settings in each of my views. Do I need to set these or does the core caching mechanisms in /admin/config/development/performance automatically do some of this and these "extra ...
user avatar
  • 1,014
25 votes
5 answers
16k views

Expose single filter of combination of two fields in views

I have two user profile fields "Last Name" and "First Name". I also have a user list views. I want to expose "Name" as filter which can search for both Last Name and First Name. How can I do single ...
user avatar
  • 4,923
19 votes
7 answers
32k views

Add FILTER CRITERIA in Views Programmatically

I want to add/modify a filter criteria programmatically. For example, for a view, I added an "Email Address" filter whose value is needed to change dynamically, it is needed to set to the current ...
user avatar
  • 1,224
6 votes
5 answers
4k views

Cannot edit my views.. I get a JSON string?

I'm using Drupal v7.22 and whenever I try to Modify the Display on views, and press the 'Add and configure' button on adding a field, or any button that sends data to the server, the page reloads and ...
user avatar
20 votes
3 answers
26k views

Filtering on node whose user ID is equal to the current user

In Drupal 6 you can have a filter node.uid = current user. How do you do this in Drupal 7?
user avatar
3 votes
2 answers
5k views

How to show the count of members that belong to a group?

I have a view showing a list of nodes of type group. How do I set it up to show the count of members that belong to each group?
user avatar
  • 11.9k
8 votes
4 answers
15k views

How to define Meta tags on Views? [closed]

Is there any module or some configuration that I can define the meta tags for the views page display in drupal 7 using Views 3.0?
user avatar
4 votes
1 answer
9k views

How to load and display a view with Ajax in Drupal 7?

This is the first time I've ever tried to load a view using Ajax in Drupal7 and I would be appreciated if you help me from scratch. I've spent hours to learn how to do this but I still failed! I ...
user avatar
  • 3,849
0 votes
1 answer
1k views

How to show authorized users a link for relevant Views results using the Rules Link module?

Assume a list of entities, created by the Views module. For example a list of "All blocked/active users" which looks like so: User name Active Created date Last login Hillary....
user avatar
18 votes
5 answers
8k views

How to Filter view by comparing 2 fields. If field-a < field-b

I have a product content type that has 2 price fields. I want to create a view that shows all products where price-A is less than price-B. I was hoping I could just add a filter and select price-A ...
user avatar
  • 181
0 votes
3 answers
4k views

Get result view with formatter programmattically

Example a view with show fields: I want retrive array result like this: [ [title, date_start data_end ... ] ]
user avatar
  • 993
23 votes
4 answers
29k views

Get the actual query executed by a view

I need to find out the SQL query that is executed by a certain query. Views module can show the SQL when configuring the view but apparently the query is not the actual query that gets run in all ...
user avatar
  • 673
17 votes
6 answers
7k views

View of users flagged by a user, users flagging a user, and nodes from users flagged by a user

I have a user flag that is pretty much like a "follow" or "subscribe" function. Basically I want to create 3 views for my website's user profile pages: A list of users flagged by a user (e.g. a ...
user avatar
31 votes
3 answers
42k views

Count results in Views using aggregation [closed]

Is it possible to count results (e.g. count the nodes of the content type x) in a view, using aggregation (not programmatically)?
user avatar
  • 2,388
15 votes
2 answers
4k views

How do I set my views to return a 404 using Global: Null under contextual filters?

Standard Drupal behavior is to pass all arguments through, whether or not they requested. Sometimes this behavior is desired. However, I need to return a 404 for anything but a query string. Example ...
user avatar
  • 1,014
18 votes
4 answers
7k views

How to combine views exposed filter with search?

My client asked me for a single field, that would work 2 ways: Autocomplete filter based on taxonomy. If site visitor inputs something that's not in taxonomy, full text search should be performed on ...
user avatar
  • 21.8k
15 votes
6 answers
17k views

How to embed a view in a specific node?

I try to embed a view in a specific node. I found tutorials for doing this with Drupal 7 and PHP-Templates: <?php print views_embed_view('view_name'); ?> But I look for a way in Drupal 8 with ...
user avatar
14 votes
5 answers
42k views

how to use hook_views_query_alter() to modify where condition?

I'm trying to modify the where condition of a views query. till now I was successful with altering "order by", but I have no idea how to alter the where condition. I want to check the search_term and ...
user avatar
  • 418
27 votes
1 answer
21k views

How to create a view type of Entity reference display?

I have an entity which contains a field collection of entity references and can edit the entity references with the Entity selection mode is Simple (with optional filter by bundle), but only Entity ...
user avatar
  • 1,269
8 votes
7 answers
17k views

Adding Theme Suggestions Programmatically For Views (Rows & Fields)

For a site I'm currently building I've got a variety of views, all with multiple display modes for different pages. For example, I have a venues view, one block is named listing which lists all of my ...
user avatar
5 votes
2 answers
14k views

Show all child nodes of a taxonomy term D7 [duplicate]

Ok, so I've been ripping my hair off for the past 2 days now. I'm developing a web-site with a car catalog which contains the following hierarchy (taxonomy hierarchy): -brand1 --model1 --model2 --...
user avatar
  • 71
7 votes
2 answers
13k views

Filter a view basing on current user's roles

Using Drupal 7, Views 3 and the Node Reference module, I'm using a view to populate a node reference field on a custom content type. (So it's a view of "Reference" display type.) I want to filter ...
user avatar
  • 755
6 votes
1 answer
15k views

How to insert values into Global custom text field of views programmatically?

How can I programmatically insert values into Global custom text field from the views. I have tried using the $views variable from the hook_views_pre_render(&$views) and ...
user avatar
  • 4,279
4 votes
4 answers
17k views

Change views pager programmatically

I'm adding nodes to a view programmatically and i'm altering the pager 'x out of y' by setting the folowing in hook_views_pre_render: $view->query->pager->total_items = $count; $view->...
user avatar
  • 121
9 votes
5 answers
8k views

How can I programmatically change the view mode?

In Drupal 7 I did something like: function mymodule_views_pre_render(&$view) { //dpm($view); if ($view->name == 'services') { $view->style_plugin->row_plugin->options['...
user avatar
  • 902
5 votes
1 answer
6k views

Get list of taxonomy terms for current node through Views

I've been trying this for awhile, and I keep finding answers that are close - but not quite. If there is a node with taxonomy terms attached to it, I want to create a block in Views that I can place ...
user avatar
  • 2,276
4 votes
4 answers
8k views

Views with Entity Reference

I'm not sure why this is difficult for me to get. It seems like it should be simple. I have a content type A and content type B. Content type B has an entity reference field to content type A. ...
user avatar
  • 1,973
3 votes
4 answers
11k views

views and contextual filters with entity reference field

how do you use contextual filters to a views block when you want to use a reference field from the content type displaying the view? here's the simple scenario artist content type has some basic ...
user avatar
  • 302
3 votes
1 answer
3k views

Views Search Ignoring Custom Node Access permissions

I have a hook_node_access function that denies users view access to a page node if the node has a certain tag and they are not an authenticated user. This is working fine for viewing the page ...
user avatar
3 votes
2 answers
3k views

How to count the node a user has created in a View?

I created a view to show Users. These users can create nodes of the "Questions" content type. The view has to render a table to show how many (the total number) Questions the user has created. ...
user avatar
  • 6,127

1
2 3 4 5
29