Views Developers
This group exists as a place for people interested in the group to talk about Views development; all development talk is encouraged here, from people who want to work on Views core to people who are interested in Views' API for their own modules. This is a good place to:
1) ask questions
2) talk about problems
3) propose ideas.
4) talk about views related projects.
This group is now unmoderated, and anyone can join at any time. Public posting of ideas is encouraged.
What I want most out of this is to keep track of what views related projects are going on and their status, and proposals for what people would like to see as Views moves forward.
Note: This is a working group. Do not post jobs here, you will lose your posting privileges entirely. Do not post support requests here; they will be deleted.
Starting Views2 Documentation
Creating this wiki page as a dumping ground for bits of documentation on Views2. It's totally a work in progress that can serve as a basis for future handbook pages.
Views Theming Documentation
This is an effort to get people in the community to do some work for me. Maybe I'm a bit lazy, but this is a piece of work that I've admitted I'm simply never going to get to. Yet it is needed.
This document is intended to be a comprehensive documented on theming Views. It should cover all of the basics, and it should also include tutorials. It really needs to be both.
I want to start with a topic list. I'm not even sure the best way to lay this out, so I'm going to start with the really obvious topics:
Views Theming Documentation
This is an effort to get people in the community to do some work for me. Maybe I'm a bit lazy, but this is a piece of work that I've admitted I'm simply never going to get to. Yet it is needed.
This document is intended to be a comprehensive documented on theming Views. It should cover all of the basics, and it should also include tutorials. It really needs to be both.
I want to start with a topic list. I'm not even sure the best way to lay this out, so I'm going to start with the really obvious topics:
exposed filters with hierarchical select
hello
D6
modules: cck, views, hierarchical select (newest versions)
i´m working on a real estate website. i added some content types like house, appartment and so on
if you add a real estate, you can add a location too, this is realized with taxonomy.
the location is split in country > state > destrict > zip-code > city> street
country is a vocabulary, state is a vocabulary and so on ...
now i have a view with exposed filters and there you can search for the location too.
Views in views in views ...
Hi,
With views 2, I've got a request wich select a list of fields from nodes. Among these fields, I've got some node references. It outpour something like this :
-
node 1 string field
node 1 image field
node 1 node reference field -
node 2 string field
node 2 image field
node 2 node reference field
Instead of having a node title link(or just a node title) representing the node reference in the view, could I outpout directly the teaser or the full representation of the node, wich would have bee overrided with a view. In the referenced node view, I could have another node reference with a view diplay, so I would have views in views, in views, in views ...
Different Banners for Different Views Filters
Hey all,
Our newspaper has a restaurant directory for the city we report in, and we're building a restaurant directory. What I've done is made a content type called "Locations" and used taxonomy to identify different locations as venues, restaurants, etc...
In this case, I've set up a view that will only show locations tagged under "restaurants".
Views Handler: Custom Sorting of Custom PHP-Script-Based Rendering
Hi
I have created a custom views_handler_field that has multiple options, as defined within a customized method views_handler_field::options_form(), of rendering a returned value provided by $this->field_alias. The customized rendering of $this->field_alias are various PHP scripts based upon the selected option; e.g. If option A, then render alias value with PHP_A(), etc...
[Solved] Views 2: Handling Arguments Titles
Hi
I am confused on how to present a Title that is representative of a prepared Path; whereby the value used within Path's % args will not be the presented value used by the Title.
For example, let's say I have a content type Project that is represented by Project ID 65 and a Project Name "Build Bridge". Every Project has a set of Tasks, and each Task maintains its relation to a Project with a database field task_project_id.
I have got the basics down on how to use Views' arguments:
<
ol>
Setting a view relationship around the content author
For my d6 site, I was wanting to display two different types of nodes both of which are created by users. Not wanting to show my stupidity I searched and searched but couldn't find anything and had previously writter a dynamic filter code for d5 which struck me as messy. Finally, I wrote something for myself that can enable it as a relationship in my code. Thought I'd share it in case other people needed the same code. If there is a simpler way, I'd love to know it but to me this is incredibly simple and shows the power of views2.
function user_relation_views_data(){
building a view across multiple node references
I'm working on a site that uses Ubercart and contains a content type called "product". Each "product" node has a node reference field to nodes of type 'foo'. Each 'foo' node has a node reference field to nodes of type 'bar'.
If the user clicks on the link for a product, I want to display all the fields for each 'bar' node that is referenced by each 'foo' node for that product. So far, I haven't figured out how to do that.
Is it possible? If so, how?
[Solved] Theming a file and location
Hi All.
I've been beating my head against the keyboard for quite a while now (days and days) trying to solve two problems. I am hoping some insight will help me save my sanity.
The first problem is with getting the path to an uploaded file.
The second problem is with getting the data out of a "location."
My set up is Drupal 6 with Views 2, CCK, and Location CCK. Everything is up-to-date.
New Approach to Content Types.
I have been writing up a white paper on how Drupal could work, but wanted to submit an initial and important first step. I know allot of people see comments as nodes being a major issue. Many want it, while others site potential problems with performance. Without comments as Nodes we have no code uniformity making any CCK features and Views features needing exceptions based on if its a node or if its a comment.
Media Browser style plugin
I've contributed a module called Media Browser providing a style plugin extension that formats a view display in an easy-to-use content browser.
Here its project page: http://drupal.org/project/media_browser. Every kind of feedback is more then welcome.
Using views to display posts in all groups that any user belongs to
Hi all, I'm having a bit of a quandry because I think I'm trying to do something that might not possible using the Views module: I'm trying to display recent posts from all the Organic Groups that a user belongs to. For example, say I have a user whose has a drupal username of "ben" and belongs to three groups. There is a page for each user on the site, in the format "users/[username]", so in this case we have the page "users/ben". On this page I'd like to list recent posts made in all three groups that ben belongs to.
Accessing Menu within a View - is it possible?
Looking to create a view that displays all Nodes not assigned to a Menu.
Wondering if this is possible, and if not how it could be achieved in a "Viewsy" kinda way ;-).
Using Views to embed an Image gallery in another node
I want to create an image gallery using the "Image Gallery" module, but instead of having the gallery displayed on it's own page, I'd like to embed & display the gallery in another node.
Proper way to mess with exposed filters
I am writing a module that lets users save 'searches' made using exposed filters.
The idea is that I use hook_form_alter to add my checkbox to the exposed filters form, as well as add my own submit handler to the form. In my submit handler I find out if the checkbox was selected, and if it was I save the exposed filter inputs to my database table along with information about the user.
New styles
Now my site-catalog have a lot of table views. My catalog would be much better if it look like these examples: http://drupalmodules.com/top-downloads , http://www.eshops.lt/category/apranga , http://ejans.com/ ...
Question about a View with Taxonomy-Filtering
Sorry this is so long. I tried to include as much detail as possible, so it could kind of act as a “recipe” for future websites like mine. (By the way, I didn’t know if this applied more to “Views” or “Taxonomy” so I posted this in both groups. I know duplication is frowned upon, but I know that most people aren’t members of both groups so I didn’t want to select only one group if the solution really lies within the conceptual framework of the other group).
A new plugin to apply an exposed filter multiple times with diferente values using AND/OR
Hello:
I'm developing a new plugin for views 2. It allows users to apply the same filter multiple times with different values.
Then, a user can make a lists of nodes and filter all nodes created by user admin where nid beetween 4 and 6 OR node id greather than 16.
The plugin works, it has some (a lot of) bugs still, but works.
Filters are saved into $_SESSION variable like drupal does for "content admininstration" and "user administration" screens.
Screencast: Setting up Views to build custom pages and access control
http://matthewm.org/screencast/drupal-views-build-custom-pages-access-control
As I await my induction into the Drupal Planet feed - here is my latest screencast.
Port Views to Drupal 7
To keep an overview of the patch at http://drupal.org/node/363410 ("Port Views to 7.x" issue), I've copied the module update instructions over here.
Please jump in, if you find something of the module update instructions you can help with. Only tick off items here, though, if a corresponding patch has been posted at http://drupal.org/node/363410. All ticked-off items should be accompanied by the patch number they were first fixed in, to make them easier to find.
Dynamic customization of views, but also need support for views ajax
Hi,
This is about a problem I have found when trying to write a feature for a module that needs to provide back reference views to nodes based on CCK node reference fields.
What I would like this to work is that the module provides a base default view that is used to provide all back refence views. This view can be modified to add more fields, change the style, add and/or expose filters, and so on. The user can also clone this view and assign the customized clone to any particular back reference relation.
View 2 Arguments: Expected value is empty
Hi
As a default to a view, I have declared a view argument that refers to node-ID (nid) and argument %1
%1 == group_Tm_Pm_Project_Tasks: Task Node ID
I then select a field and check Output this field as a link
.
The Link path:
I provide is node/%1
However, when the check the link path, it is showing http://##.##.##.##/node/
Thereby, the expected value of nid is blank within %1
For what reason am I seeing this?
Thanks
Jeff in Seattle
View 2 Filters: Criteria defined by PHP scripts?
Hi
Can a PHP script be assigned as a Filter criteria when one is within View Edit UI /admin/build/views/edit
?
Or even establish a filter to be used by a view via some view hook()
?
Thanks
Jeff in Seattle
Having heck of a time getting plugin to work.
Hello all.
I'm having a good amount of difficulty in getting a style plugin to work and I was hoping I might get a little guidance from you good folks.
Working from the instructions at http://groups.drupal.org/node/10129, I put together the following.
first, in the module cp_helper.module:
<?php
function cp_helper_views_api() {
$api = array(
'api' => 2,
'path' => drupal_get_path('module', 'cp_helper').'/views'
);
return $api;
}
?>I then created views/cp_helper.views.inc:
<?php
function cp_helper_views_plugins()
return array(
'row' => array(
"Output this field as a link" You can use tokens but what about php?
Hello all,
I am curious if anyone has done something similar to this:
when creating the fields to use for my view, i want to rewrite the title link using both tokens and php.
i want to be able to check a condition (if taxonomy is present) and if so re-write that link accordingly.
is there anyone who has done this / knows if it is possible or knows of another module or patch that can solve this problem?
thanks in advance!
regards,
steve
ps... the attached image just shows the views UI with my available tokens, thought it might be on some use.
Displaying grouped data with group label subheadings
Creating a dropdown list of fields to sort by
Constraining fields which are not the "primary" node
I'm making a custom list of nodes and their comments. I'd like to be able to both constrain the number of nodes (easy: Items per page refers to nodes in this case) but also constrain the number of comments displayed per node (e.g. the 5 most recent).
Is there any way of doing this in Views? It's easy enough to make a view which has the comments in and an argument to provide the node id, were it possible to include such a view inside another view, for example.
Does Views supports MIN(), MAX() in SELECT queries?
Hi,
Does views supports queries like for instance
Select node_revisions.vid, MAX(node_revisions.created) FROM node_revisions
which could return the last revision created for each node?
Thanks!
Creating Sub-Sub-Tabs off of a Sub-Tab
Hi
Query: I am trying to do sub-sub-tabs off a sub-tab.
I think I am doing it correctly. The sub-sub-tab link paths are viable but they are not visible below its sub-tab.
Documentation: This discussion, I think, would be a good submission to documentation, if it would help.
- How DEEP of sub-tabbing can one do in Views 2?
- If on one-level of Sub-Tabbing, then can I make them deeper?
- I am beginning to wonder if this a theme-ing issue (I am using Zen-Classic).
Views 1: how to sort on fields from 2 tables?
I'm working on a D5 site (yes, unfortunately!) where we use taxonomy to create a "poor-man's-epublish" - basically a view of newsletter issues and articles under them. We have a vocabulary for "Newsletter issue" and just tag article nodes with the term of the issue, like "Fall 2008." Since there are other vocabularies on those nodes we're using the primary_term module to make the newletter issue the primary term.
It's all working great except for sorting: primary_term.module only implements views sorting by term id - it ignores the term weight:
How to construct a child term query through the API?
Briefly, I know this sounds like a general query, which shouldn't be on this list. Two reasons,
1) This is for module integration, through the API.
2) Drupal core doesn't lean much towards trading with the Taxonomy, so we don't expect that of Views, either. We know we are wading in rather deep. Someone on the case could spare us trouble.
So, what are we up to? We've got our Views hooks up and running. We figured we wanted this query as a relationship. Views provides 'Parents' as a relationship, so 'Children' ties in with the developers, and also makes sense for a user.
Help needed with constructing Views query and module integration
At least in part, the aims of this group seem to be concerned with gathering new ideas for Views from the stumbling of others. So I hope is that this is of interest (it is to me).
I'm new to Views. Very new. I spent 2 hrs with it yesterday evening. I didn't make much progress. Here's what I would like to do,
-
Construct a view of child terms, from a term.
(note, term data in the results, not node data) -
Make a generalized path. Along the lines of /child-terms/% (% being a term).
(I know this kind of functionality is one of the stars of Views, but I like little steps)
Views: Sort by multiple columns
Hi
I have a primary key that is multiple columns, e.g. Last and First Name.
Within hook_views_data() can I declare that I have such a sortable relation and thereby within a view sort by multiple columns?
Thanks
Jeff in Seattle
Custom Sort View Handler is Ignored
Hi
I have read the link http://drupal.org/node/357079, but my custom sort handler is not getting called.
Implemented is the following empty sort handler. However, when I select the activated table-style column to sort, this sort handler is ignored.
<?php
class region_views_handler_sort extends views_handler_sort {
function query() {
parent::query();
drupal_set_message('region_id custom query()');
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
List CCK Fields for a node revision
Hi all!
I would like to know if it is possible to list cck fields for each node revision, in order to see evolution of the cck fields in the node revision for instance.
It is already possible but with a node view type.
I would like to have this for node revision view type.
It could be great to implement the relationship in the cck's views integration.
Does somebody know if it is already available?
Thanks you
creating a custom module to override the default exposed filter widget type?
Hello,
I'll start with the good ol' i'm new to drupal and creating custom modules spiel...
(btw, im using the most current versions of drupal and views)
What i need/have been trying to do is create a filter for a view that uses select dropdowns based on values that are collected from a cck text field.
(for example: a user adds a new node, there is a field called type and the user can enter whatever he wants. when the form is submitted, and he goes back to the list view, his entry in the type field now shows up in a select dropdown along with all of the other options that other users added. now he can filter the view with his own type entry.)
View Handler methods "query()" and "pre_render()"
Hi
What is the purpose of the View handler method query()?
Using a skeleton class that traces the calling of the View handler methods, I see that method query() is called before method pre_render(). Is there an expected work flow relation between these two methods?
Thanks
Jeff in Seattle
Views Calc not working
I´ve recently installed views calc (I´ve got last stable release of views and cck), and got a nasty error:
warning: Invalid argument supplied for foreach() in .../sites/all/modules/views_calc/theme.inc on line 160..(*)
But, sometimes, randomly, the error won´t appear, but the view won´t work either.
I´ve look for that error at the forums, and found nothing.
I´m attaching the strange and totally random behaviour of Views Calc as a png. It should show the sum of the one column with the prefix $.
hook_view_draw(): Trick it to add input fields?
Hi
I am just curious if there is a way of tricking the items array returned from hook_view_draw() whereby some of the array elements do not reference a field within a table in a database, but actually a input like a button?
For example using users table, generate a view from a custom hook_view_draw() the following:
Sortable Sortable
[User ID 1][User Name 1][Update Button for User ID 1][Delete Button for User ID 1]
[User ID 2][User Name 2][Update Button for User ID 2][Delete Button for User ID 2]
Index & Hierarchy API: browsable data display based on (virtual) hierarchy.
Introduction
Dynamic Date Range Filter
Hey Guys,
I'm trying to change the date filter for one of my views dynamically so I can output a set of nodes from a fixed time frame depending on the views argument. For example, if the argument date is 2-19-09, I would like the view to display all nodes created between 2-10-09 to 3-10-09. I wrote the script to calculate the min and max date for the view, however, when I try to set those parameters and display the view the date range limit is not applied.
Contextual Views
I'd like to seed a discussion on Contextual overrides for views 2 module, a possible extension to the Interests module (Which i originally developed while working at Agileware and still partly maintain). I would also like to point out contextual based modules already exist, but they are not what this module has in mind.
To give some background on the idea...
'extra' field in hook_views_data()?
In hook_views_tables, I used the 'extra' field to make sure that when my table was used in a view,it ony used records which matched the current group. i.e.:
<?php
$tables['og_users_roles'] = array(
'name' => 'og_users_roles',
'provider' => 'internal', // won't show up in external list.
'join' => array(
'left' => array(
'table' => 'node',
'field' => 'uid'
),
'right' => array(
'field' => 'uid'
),
'extra' => array(
'gid' => '<strong><em>CURRENT_GID</em></strong>'
),
),
?>how can i add group by
HI,
I am new to drupal.I have an issue with views.
How can i add group by clause to views.
when i used "function add_groupby" ,it is adding group by by grouping all fields in the query.
SELECT state_downtimes.down_id AS down_id, state_downtimes.reason AS state_downtimes_reason, state_downtimes.startdate_planned AS state_downtimes_startdate_planned, group_concat(title separator ' ,') AS title
FROM state_downtimes state_downtimes
LEFT JOIN service_downtimes service_downtimes ON state_downtimes.down_id = service_downtimes.downtime_id
Chosing name for Theme file Views
Hello people and thank for the help in advance.
I'm creating this thread because i have a problem theming views.
I would like to use the same template file for views with diferente names.
For example:
View_A -> template_file_view_ab.tlp.php
View_B -> template_file_view_ab.tlp.php
View_C -> template_file_view_cd.tlp.php
View_D -> template_file_view_cd.tlp.php
Does anyone knows how to do it?
Thanks in advance.
Wanted: Your Devel/Troubleshooting Tips
I'm writing a Views 2 argument handler for a module I maintain. Steep learning curse, though I've made some progress. I'd love to hear any wisdom you've accumulated working on Views 2 handlers and plug-ins. Especially around troubleshooting/bug tracing strategies. Reference material also appreciated.
Select fields as exposed filters rather than text input fields
Is there a way (aside from using hook_form_alter or something similar) to have an exposed filter be a select element?
I have a view in which one of the exposed fields is "Category" and there are only 9 or 10 distinct values in the database field. Rather than having to type in one of the categories, I'd like for users to simply choose from a select box.















