Skip to main content

Questions tagged [views]

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

Filter by
Sorted by
Tagged with
8 votes
1 answer
8k views

How do I set a table header in Views 3?

How exactly do I get a table header to appear above the table? In views-view-table.tpl.php I can see a <thead> section, but what causes it to actually get rendered? Where do I specify the column ...
no more drupal's user avatar
8 votes
7 answers
7k views

Sortable table: secondary sort

I have a view (Drupal 6 / Views 2, but I think this may apply to other versions as well) displayed as a sortable table. I can add fixed sort criteria as you can with all views, but once the table is ...
marcvangend's user avatar
  • 14.9k
8 votes
1 answer
9k views

How can I insert PHP code in Views?

I tried the views_php but I have no luck. Any link to its documentation? I want to add some custom field with PHP code inside it but the one I did return nothing. Please see the attached picture.
ninjascorner's user avatar
  • 1,841
8 votes
4 answers
14k views

How to use template_preprocess_views_view to pass a variable to a views tpl file

Since the case re-occurred to me for the second time recently, I decided to ask the question so to perhaps learn something. In Views, the main display title (the one that usually gets rendered at the ...
no more drupal's user avatar
8 votes
2 answers
5k views

Can't Rewrite the output of this field in views 7.x-3.3

I don't know if I am missing something, but when I check the box for Rewrite the output of this field or anything under the style options to customize the HTML nothing happens. I check it, save it, ...
Greg Somers's user avatar
8 votes
1 answer
3k views

how do I get my module to install a view?

I have developed a module in a dev environment. I built a view for it using the UI. I've exported the view, but I don't know where to put it so that an installation of the module in a fresh ...
user1359's user avatar
  • 3,919
8 votes
2 answers
13k views

Dynamically adding a CSS class to a view row with template.php

I've actually reached the bottom of Google trying to figure out how to add a css class to each row of a view. The trick is that I need the class for each row to be dynamically determined based on ...
JGrubb's user avatar
  • 377
8 votes
2 answers
13k views

How do I create an AJAX filter for a view?

I have created a page using Views and it works fine. I want to add an AJAX filter to this page to allow visitors to filter the contents based on PubDate or by Taxonomy/Vocabulary for this content type....
Lina's user avatar
  • 183
8 votes
4 answers
22k views

Using a custom view for a taxonomy term page

Using Drupal 7 and Views 7.x-3.0-beta3, what is the best way to have a taxonomy page use a custom view? For example, in Path Auto I have a rule that points the URL alias countries/england towards ...
Chris Hawes's user avatar
8 votes
2 answers
1k views

How to avoid Drupal redirecting my multilingual Views pages?

I've got a Views page in a multilingual website where I need a different url for each language, ie: es: mysite/apartamentos. en: mysite/appartments. fr: mysite/appartements. ru: mysite/arendu. I ...
Miquel Correa Casablanca's user avatar
8 votes
1 answer
1k views

How do I add a date field that can be filtered by a relative value?

If I create a view, I can add a filter that filters on a relative value on some built-in date field, such as Post date. For instance, the screenshot below shows a filter I've created that will show ...
Free Radical's user avatar
  • 15.1k
8 votes
2 answers
6k views

How to theme Panels properly?

I am using Page Manager and Panels, providing custom node panels with selection rules by type (e.g. one panel variant for article-, one panel variant for blog-content type). This works smooth so far, ...
Andre Baumeier's user avatar
8 votes
4 answers
5k views

How can you sort taxonomy terms based on number of times used, in a view?

I'm creating a view that lists the top 10 most popular taxonomy terms (tags). Currently I have the view returning all the terms and I can limit the view to 10 but I can't work out how to order the ...
Camsoft's user avatar
  • 3,139
8 votes
1 answer
2k views

How do I display the last person that edited content instead of the original author?

On the page /admin/content, there is a column for Author. We have a lot of people editing our content, so the original author isn't all that important. I want to change it to show the last person that ...
The Unknown Dev's user avatar
8 votes
2 answers
3k views

How to check for entity access when displaying views fields?

I have a custom entity. There is an access callback defined in hook_entity_info() and it is called when I access the entity. Also in views when I select to display rendered entities, the entity is ...
Neograph734's user avatar
  • 8,429
8 votes
1 answer
1k views

When should I create multiple Displays of a View instead of multiple Views?

Is it simply a matter of convenience to create multiple Displays of a View instead of multiple Views, or is there a performance benefit? Does having any of the following items present in some ...
PetroleumJelliffe's user avatar
8 votes
4 answers
5k views

How to redirect an exposed filter query to a views results page that lives in another panel page?

My setup: Drupal 7.2, Panels 7.x-3.0-alpha3, Views 7.x-3.0-beta3, Chaos tool suite 7.x-1.0-beta1 Say I want to create a fruits directory website. In views I have a content pane "fruits" with exposed ...
Andreas's user avatar
  • 81
8 votes
1 answer
10k views

How to render paragraphs module in twig

I am creating a custom template for my theme and I am constructing a page.html.twig page. I want to call of the individual node fields into separate rows. I have been able to successfully display ...
Megan McGowan's user avatar
8 votes
5 answers
911 views

How to publish nodes 3 times a day?

I have a list of unpublished nodes, created with the Views module. I would like a task to be run 3 times a day, at specified times. Every time the task runs, only one of the nodes on the list should ...
big_smile's user avatar
  • 2,828
8 votes
4 answers
5k views

Views 3, contextual filter on language - allow for multiple languages

So for this site I'm building I need to be able to do the following. When user views the site in English show all English articles When the user views the site in Dutch, show all Dutch articles - but ...
Kasper's user avatar
  • 295
8 votes
1 answer
6k views

How to load a view with ajax so that additional js/css files needed by the view are also loaded?

Currently I'm using jQuery to load a view, like this: $.ajax({ type: 'POST', url: Drupal.settings.basePath + 'views/ajax', dataType: 'json', data: 'view_name=' + viewName + '&...
Temaruk's user avatar
  • 499
8 votes
1 answer
3k views

Is there a way sort View by results of "Options" Rate/Voting API widget?

I'm using the Rate module to allow voting on whether or not a given node is "Helpful" or "Unhelpful". I have a view with all nodes of this type, and the view includes a field for the Rate widget. I am ...
Mrweiner's user avatar
  • 1,921
8 votes
3 answers
1k views

Is there a way to intercept a list of NID's created by a view and use them as a filter for another view?

I am at the point in Drupal experience where I am attempting to solve site design challenges at the custom code level using Drupal and Views APIs. As usual, my apparently simple attempt to solve a ...
Ashlar's user avatar
  • 5,115
8 votes
1 answer
7k views

Custom views filter

In Drupal 8, I have a view that gathers all the nodes built in my Gallery Hours content type. The content type has a field called View Order that I use for another view that displays the list of ...
Kummerow's user avatar
8 votes
1 answer
2k views

Get the number of followers and following in user relationship

I have created a relationship Followers which can be reciprocated using the user relationship module. Now user A's relationship is something like: Followers(Them to you): User B, User C, User D ...
why's user avatar
  • 1,147
8 votes
2 answers
7k views

How do I use contextual filters and relationships to show related articles?

So, I've been trying to get this figured out for most of the day. I had it essentially working in the previewer at one point, but now it doesn't seem to work at all. Use case: each node published ...
John Riley's user avatar
8 votes
2 answers
2k views

Paging a view based on a grouping field?

I'm upgrading a site I created 2 years ago from D6 to D7. In that site, I have a view of items that are grouped according to year, so that the items for each year show up on a separate page -- you ...
cellear's user avatar
  • 81
8 votes
0 answers
13k views

How do I programmatically change a view title? [duplicate]

I would like to change my Views (page display) title programmatically. For Drupal 6 I found Setting the View-Title programmatically in Views2, but it doesn't work for me. function ...
giorgio79's user avatar
  • 4,631
8 votes
1 answer
503 views

Order list: Pay unpaid invoices

I have created some extra statuses: Paid and Unpaid. Now they got the functionality and react on the transaction balance perfectly fine. However, on the user site, it is kind of a dumb thing. Even ...
user6958's user avatar
7 votes
5 answers
8k views

Changing an inner join to a left join in views 3.3?

Using views 3.3, I have a view in Drupal 7 where I am showing two content types. I have a filter criteria based on the value of a field that is attached only to one of the content types. So long as I ...
user1359's user avatar
  • 3,919
7 votes
8 answers
19k views

How do I print the SQL query of a view in front end?

I have installed latest Drupal 8.1.1 also Devel module installed there is no any option for Display query log on devel setting page while it's present on D7 Devel module. I have created a view with ...
Sanjay's user avatar
  • 93
7 votes
7 answers
28k views

How do I embed a view inside a node?

In Drupal 6 a view can be embedded into a node as follows: $viewName = 'LatestNews'; print views_embed_view($viewName); This does not work for drupal 7. What is the function to embed views in ...
Natkeeran's user avatar
  • 272
7 votes
3 answers
19k views

How do I create a custom template for view? [closed]

I have created a content type called "Hotels". I want to display to the view in different manner other than view options provided by Views module. For that I have to create custom template but don't ...
Rahul's user avatar
  • 93
7 votes
6 answers
6k views

How can I get numbered classes on rows?

I worked briefly with Drupal 7 and I thought it was possible there but in Drupal 8 is it possible to have a view output an increasing numbered CSS classes for Views rows? This is what I want. <...
BrandenB171's user avatar
  • 1,112
7 votes
3 answers
8k views

How to add a view mode for entity type?

I want to add a view mode for particular entity type programmatically in Drupal 8.I think the documentation on view modes for Drupal 8 has not been provided like it was provided for Drupal 7 hence I ...
user2750995's user avatar
7 votes
2 answers
8k views

Exposed Post date filter on views

When you expose a filter date on views you get something similar to the following: When you expose the post date you get: The former is a lot more useful. Is there a way you can get the post date to ...
Jeff's user avatar
  • 311
7 votes
4 answers
7k views

Customising the first item in a view

As a block on my homepage I'm trying to output: <ul> <li><a><img><p>Node 1</p></a></li> <li><a>Node 2</a></li> <li>&...
Daniel Nitsche's user avatar
7 votes
6 answers
5k views

How to clear cache externally?

I'd like some help how to clear the cache using an external script. I have a script that adds nodes each night, and I'd also like it to clear the views cache so - without having to make out by myself ...
Daniel Holm's user avatar
7 votes
1 answer
4k views

Show the pager on the top and in the bottom of the page (generated by Views)

I created a view and set a pager for it. I is shown in the bottom of the page. Is there any way to show it both in the bottom and in the top of the page?
chefnelone's user avatar
  • 6,257
7 votes
4 answers
4k views

How do I properly add css to my feature?

I have a feature that just contains a few views. How do I properly add a stylesheet to it?
nigel's user avatar
  • 71
7 votes
1 answer
12k views

How to change Views field settings programmatically?

I would like to change some field settings in a given view created with Views programmatically. For example, I would like to change the "Formatter" and "Image style" settings of an Image field. This ...
Sk8erPeter's user avatar
  • 1,799
7 votes
5 answers
18k views

Count number of values within a field that accepts unlimited values [closed]

I have an image field which can contain unlimited values. How can I display the number of image values contained within this field in views? I'm using Drupal 7.
jeroen's user avatar
  • 864
7 votes
2 answers
4k views

How to resave all my nodes

In D7, it was easy with the VBO module.. But how to do it with D8? (Preferably using a view to select the nodes to resave) In many places I saw that a small part of the VBO module is now included in ...
Baud's user avatar
  • 542
7 votes
2 answers
6k views

How to filter by two fields using a single exposed filter in Views? [duplicate]

I have a view listing nodes. I added 2 exposed filters. One is Content: title and the other is Content:Body. Then I have 2 input fields to enter some keyword to do searchs. I need to have just one ...
chefnelone's user avatar
  • 6,257
7 votes
1 answer
9k views

Access field value in template_preprocess_views_view_field function?

I have a client with a Drupal 8 site who prefers curly quotes to straight quotes. I have successfully made this change for node titles using a regex replacement in template_preprocess_page_title. Now ...
JOakland's user avatar
  • 462
7 votes
2 answers
5k views

Drupal 7 views, filter by owner

I need to show the list of the content created by the currently logged-in user. How do I do this with the Views module?
Konstantin Bodnia's user avatar
7 votes
2 answers
982 views

View uses the wrong template when cache is enabled

I'm using the latest version 8.2.4 of drupal core, which ships with view. After enabling the internal cache system, some of my views get broken. My view configuration is: uuid: xxx langcode: de ...
freakimkaefig's user avatar
7 votes
3 answers
16k views

How do you print View fields on Twig?

I have a view and added the title as a field. For example: How do I print the title? In Drupal 7 it was as simple as views-view-fields--[viewname].tpl.php <?php print $fields["title"]-&...
No Sssweat's user avatar
  • 31.4k
7 votes
1 answer
16k views

can we add new column to a view programmatically?

I want to add new field in a existing view programmatically. I am trying to use hook_views_pre_render(). function registration_export_views_pre_render(&$view) { if ($view->name=='...
Tushar's user avatar
  • 177
7 votes
4 answers
28k views

How to get a parameter value from the current URL in views-view-fields.html.twig?

I need the argument value in the theme templates and using the views-views-fields--view_name--block_1.jhtml.twig. I'm current getting the current URL like that: {% set url = url('current')%} Which ...
Narinder Bajwa's user avatar

1
3 4
5
6 7
305