views

Posted by: 
Dominique De Cooman

If you want to create a custom views access plugin the reason for this will be to allow you to have an entry point to add custom logic to protect the access to your view.

Let say you need a finer access control to a view than roles and permissions. For example you are storing properties on a user object who determine if certain user can see certain views independent of their roles.

What we need to do, is to configure our views correctly with a views access plugin.

The hacky way:

Drupal as dataserver

Using drupal to serve data to other sources? Consider this module to use views as tool to list content in other formats easy shareable across the web.

http://drupal.org/project/views_datasource

Posted by: 
Dominique De Cooman

We ll do this with an example as usual.

We have a table with book entries forming a top 100 which gets and update every week. Each entry has a current position, a last week position, a corresponding node id and a week.
We ll create a file in called book_top100.views.inc, in that file we ll implement hook_views_data() and a hook_views_handlers().

Posted by: 
Dominique De Cooman

Our example: we try to set the default value for a filter on a certain week.

I tried to set the default value of your exposed filter in:

<?php
$form
['week']['#default_value'];
?>

Didnt work.
In get forms you need to set the $form_state['input']['week']. Also you need to make sure the value isnt submitted yet so check on $_GET['week'] to get the actual value.

Multilingual views in Drupal when using i18n module

Building multilingual sites in Drupal can give issues with the views.
By using the excellent insert view module you can embed a view directly into a node.

http://www.computerminds.co.uk/multilingual-views-drupal-when-using-i18n...

Pushing the envelope with display suite

Nice introduction to display suite

http://krimson.be/articles/2010/07/01/pushing-envelope-display-suite

Also check this article I wrote a couple of weeks ago about the display suite, which goes a bit more in dept http://dominiquedecooman.com/module-review/display-suite

Subscribe to views