Questions tagged [views]

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

Filter by
Sorted by
Tagged with
16 votes
3 answers
12k views

Views exposed filters without "Apply" button

I have created a view with exposed filters of term select list. How can I make the select list to work directly on selecting an item, instead of clicking on the "Apply" button?
AnAnD's user avatar
  • 616
16 votes
3 answers
20k views

Removing main content block on frontpage

I'm new to Drupal 7 and I'm looking to replace the frontpage's default main content block with an equivalent block generated from Views (gaining more control over the block in doing so). I have ...
irishbuzz's user avatar
  • 645
16 votes
4 answers
12k views

How do I get $view->the actual row number?

How do I get the actual rows number in views-view-field--title.tpl.php in Drupal7 and views3? I know how to get the total by $view = views_get_current_view(); $view->total_rows; But how do I get ...
jospBln's user avatar
  • 201
16 votes
1 answer
2k views

View commerce product image and price fields

In Drupal 7 commerce I ran into a problem. I want to display the latest 3 items placed in the show_product content type, with attributes from the store. There are several entities in the store, ...
JurgenR's user avatar
  • 2,163
15 votes
4 answers
28k views

How do I get the raw URL as a field in Views?

In views I need to return the raw url that is provided as the href value to the title field (when as a link) or the Content: link value. I thought originally I could choose Content:link and strip the ...
blue928's user avatar
  • 3,794
15 votes
6 answers
18k 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 ...
TiMESPLiNTER's user avatar
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 ...
Nigel Waters's user avatar
  • 1,014
15 votes
4 answers
17k 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 ...
Sam's user avatar
  • 367
15 votes
4 answers
5k views

How do I filter only the root terms in a vocabulary in a view?

I have have a vocabulary structured as so: Root Alpha Term Alpha 1 Term Alpha 2 Subterm Alpha 1 Root Beta Root Gamma Term Gamma 1 Term Gamma 2 How do I filter the view to show only the root ...
Phizes's user avatar
  • 1,266
15 votes
1 answer
257 views

What is "Advanced Mode" in Views 3?

In this article the first instruction is On every site, run drush vd to turn the Views settings to the advanced mode. What does this mean? A Google search for "Views advanced mode" yields mostly ...
beth's user avatar
  • 9,087
15 votes
3 answers
4k views

Having views respect hook_node_access [duplicate]

I am using hook_node_access() to deny users access to some nodes based on a custom criteria. However, I do not want this content to show up in a view that lists it if the user does not pass the ...
nenne's user avatar
  • 251
15 votes
2 answers
9k views

How can I alter the value of a filter and have the output altered before the view renders?

When using Drupal 7 and Views 3, what is the correct way to alter a Views filter value so that it affects the content that's just about to be rendered? I tried everything mentioned here for D6. ...
blue928's user avatar
  • 3,794
15 votes
1 answer
12k views

How to integrate Field collection module in Views?

I have created fields and grouped together with Field collection module. I have attached the group field (containing 4 fields), to user account settings in : admin/config/people/accounts/fields. Now ...
radu c's user avatar
  • 4,350
15 votes
1 answer
1k views

What is causing Views to consistently but intermittently not find a view provided by the Advanced Forum module?

I'm getting a frequent, intermittent error from the Advanced Forum module that causes a 500 error when it occurs (WSOD). On production, it's happening about 20 times per hour, on probably 2-3% of all ...
Justin's user avatar
  • 3,683
14 votes
3 answers
36k views

Using hook_form_alter on exposed view filters on Drupal 7

I'm having some trouble using hook_form_alter() with Views 3 and Drupal 7. I'm unable to add an if statement to uniquely identify a view; whatever I put in, the if statement is never found to be ...
SimonK's user avatar
  • 141
14 votes
1 answer
8k views

How to add Clear button for views exposed filter?

I created a content type and View with Filter Criteria for my project, when I click the Search it shows the appropriate results. But there is no option to clear the Search Fields and redirected to ...
Sam1604's user avatar
  • 289
14 votes
3 answers
5k views

How to store Views templates with a module instead of a theme

I have created several views templates that are currently stored in my active themes directory. In would prefer these templates be stored within my module directory. My question is, how can I bring ...
Citricguy's user avatar
  • 7,884
14 votes
1 answer
26k views

Related nodes by taxonomy term in a view block [closed]

In Drupal 7, I've got a content type called "Asset" with a taxonomy field called "Category". All I need is a Block on the Asset pages that looks at the current node's Category term(s), finds all other ...
Sam's user avatar
  • 819
14 votes
2 answers
17k views

In a view, how can I link a field to the node?

In a fields view, the "title" field has a check box "Link this field to the original piece of content". But this check box isn't available for other fields. How can I achieve this functionality for ...
daphshez's user avatar
  • 1,082
14 votes
5 answers
43k 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 ...
nooshinha's user avatar
  • 418
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 ...
Eduardo Gabriel Cabrera Japa's user avatar
14 votes
1 answer
8k views

What is the difference between rendered entity and content in views 3?

In the Format option for a view, the options include Content and Rendered Entity. They both offer you a selection of view mode for the content. The former includes some extra options on comments/...
artfulrobot's user avatar
  • 3,969
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" ...
uwe's user avatar
  • 12k
13 votes
1 answer
7k views

How do I get Views content items in "my language" but fall back to "default" if the content isn't translated?

This is probably very easy but endless searching has proved fruitless - there's lots of UI changes between the D7 and D8 versions of these modules it seems. What I want to do is create a blog in two ...
NikLP's user avatar
  • 993
13 votes
3 answers
13k views

What does vid mean

I have designed a view and I see this query in the preview section: SELECT node.nid AS nid, node_data_field_crm_history_brokerid.field_crm_history_brokerid_value AS ...
user avatar
13 votes
3 answers
10k views

How to group views rows by year using date field?

I have a content type with a date field. I need to output them grouping by year, i.e. 2011 - nodeA 2011-09-01 - nodeB 2011-01-29 2010 - nodeC 2010-12-08 How can I do that?
Michał Pękała's user avatar
13 votes
6 answers
6k views

How do I pass contextual filters to a view via services

I have a view that accepts a contextual filter in order to return the correct results. I'm using Services 3 and Drupal 7. I'm able to create an endpoint, and retrieve the view via services. But it ...
user379468's user avatar
  • 2,520
13 votes
5 answers
11k views

Is it possible to dynamically set Views' pager settings?

Say for instance, you have a view that displays when viewing a certain node type, but you want the pager settings to be different for each individual node. I was thinking of making a CCK field like "...
Jay's user avatar
  • 829
13 votes
3 answers
9k views

How do I show only 3 of the latest posts for each term in a view?

With the help of another question: Show newest nodes for each taxonomy term in Views I have been able to create the view I require, except that it displays all posts for each term (grouped by term)? ...
Nigel Waters's user avatar
  • 1,014
13 votes
5 answers
3k views

Building a Views Filter

I want to build a filter for a custom module I built and have integrated with views. In essence, the module allows you to define types of relationships between different nodes. I'd like to create a ...
lordg's user avatar
  • 705
13 votes
8 answers
21k views

Add style attribute to view fields

I would like to add a style attribute to each title fields in my view. I have created one field for a color. I tried to rewrite the result like this: <h2 style="color: [field_color];">[title_1]&...
Ksn's user avatar
  • 133
13 votes
3 answers
4k views

What is the best way, programmatically, to iterate through a view's results?

Given a view, named 'Children' (with two fields: child_node_id and a birth_order_value) what is the best way, programmatically, to iterate through the views results set given a display_id of 'default' ...
clsturgeon's user avatar
13 votes
4 answers
2k views

Loading nodes from another Drupal database using Views

I'm trying to use Views to load nodes from another Drupal database defined in settings.php with a key of 'cms'. Both sites are Drupal 7. The other database is a different Drupal install which is ...
Cottser's user avatar
  • 2,635
12 votes
4 answers
17k views

drupal_goto(request_uri()) replaces my '?', '=' and '&' in url

I need to redirect user from a page with example.com/node/add/dispo?arg1=1&arg2=2 to the same type of URL. But when I simply do a drupal_goto(request_uri());, it redirects my user to example.com/...
Gregory Kapustin's user avatar
12 votes
8 answers
15k views

How to theme the views exposed form?

I've created a view with a number of exposed filters, but it is pretty ugly looking. I'd like to improve the theming, including wrapping the whole thing in a fieldset as well as grouping some of the ...
HorusKol's user avatar
  • 207
12 votes
1 answer
5k views

Views 3 doesn't recognize a declared handler. Why not?

In modules/addressfield/addressfield.module I have: /** * Implements hook_views_api(). */ function addressfield_views_api() { return array( 'api' => 3, 'path' => drupal_get_path('...
Adam S's user avatar
  • 5,031
12 votes
5 answers
6k views

Highlight searched keyword using exposed filter views?

In a view and I added an exposed filter: Search: Search Terms filter It works fine, but I'd like to highlight the searched keyword in the results. How can I do it?
chefnelone's user avatar
  • 6,187
12 votes
7 answers
12k views

Why `GROUP BY` in hook_views_query_alter() doesn't work?

I'm using Views 7.x-3.6 and I tried altering the GROUP BY clause with hook_views_query_alter() as below: function mymodule_views_query_alter(&$view, &$query) { if ($view->name == "...
jozi's user avatar
  • 494
12 votes
6 answers
5k views

How to restrict direct access to the nodes?

How to restrict direct access to the nodes but just allow views to access the required field of the particular node type? For example in Views Slideshow we are sliding the image field that belongs to ...
Fahad Ur Rehman's user avatar
12 votes
3 answers
5k views

Filtering a view by a checkbox field

My site has a node type called "Resource". This node type has a field called "Reviewed"; this field is a single on-off checkbox: I've created a view that lists all of the nodes of node-type "Resource"...
Jim's user avatar
  • 833
12 votes
2 answers
17k views

How to pass an argument into Views for Drupal 7?

I'm trying to pass an argument through a block created by a view. The node is an ubercart product node. I have aliased the paths such as: node/45 to products/[name] In contextual filters, I've ...
chrisck's user avatar
  • 471
12 votes
2 answers
14k views

Overriding views-view-fields.tpl.php

Is it possible to override views-view-fields.tpl.php file for a specific view? I've tried creating a views-view-fields--view-name.tpl.php file and have re-scanned template files and cleared the cache ...
nmc's user avatar
  • 2,077
12 votes
2 answers
4k views

Views3 and subqueries?

I've got a view which generates a query that does multiple joins. This produces a cartesian join, and I need to "convert" the joins to subqueries. I've looked through documentation, Google search ...
sbrattla's user avatar
  • 1,149
12 votes
3 answers
8k views

What is the difference between an 'Attachment display' and a 'Global: View area' put into header/footer of a view?

I'm trying to decide which should I use. Both can inherit contextual filters, so in my case both of them are good solutions. Except that I already have the other view that I want to put together with ...
Temaruk's user avatar
  • 499
12 votes
1 answer
1k views

Does using MongoDB for field storage limit functionality?

I am considering using MongoDB on a site for field storage, and not just moving cache, session, lots, etc., out of my SQL database. The Field Storage API should make this seamless, assuming I am ...
Jacob Bolton's user avatar
12 votes
2 answers
588 views

Problem trying to create a views with tabs. Link of tab doesn't point to the path I set

I am trying to create a views with tabs: so that a page that has several tabs, the View has a primary page that shows all Article nodes, a tab for all Event nodes, and a tab for Blog nodes. Something ...
gilzero's user avatar
  • 6,037
11 votes
5 answers
23k views

hook_preprocess_page(): how to tell a views page?

Im writing a custom module that need to insert some javascript and css files only in a Views page. Im using hook_preprocess_page, but I can not tell if the current page is from a view: function ...
Strae's user avatar
  • 890
11 votes
3 answers
9k views

Views Page not showing pager

I've got a Views Page showing Article teasers. There are lots of Articles in the db and I'm only showing 5 per page in the View, but the Pager is not showing up at all. Here is my Views configuration, ...
Kenny Wyland's user avatar
  • 3,038
11 votes
6 answers
8k views

Splitting up content fields into different regions

My situation is as follows: I have a content type Seminar, with fields A, B, and C. I have regions Header, Footer, Content, and Sidebar Left. There are some fields in Seminar I want displayed in the ...
Lester Peabody's user avatar
11 votes
9 answers
10k views

Views slideshow from single node

I'm trying to achieve working slideshow from images in single node. Images are uploaded from the image field. It's drupal 7. I made new content type and all I made now is slideshow from multiple nodes ...
smogg's user avatar
  • 243