views_random_seed.module in Views random seed 6
Same filename and directory in other branches
Adds a random order handler with seed. If a constant integer argument N is specified, it is used as the seed value, which produces a repeatable sequence of column values. This makes it possible to have paging and not having items show up twice. See http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#funct...
File
views_random_seed.moduleView source
<?php
/**
* @file
* Adds a random order handler with seed. If a constant integer argument N is specified,
* it is used as the seed value, which produces a repeatable sequence of column values.
* This makes it possible to have paging and not having items show up twice.
* See http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand
*/
/**
* Implementation of hook_views_data()
*/
function views_random_seed_views_data() {
$data['views']['random_seed'] = array(
'title' => t('Random seed'),
'help' => t('Randomize the display order with a seed which makes paging possible.'),
'sort' => array(
'handler' => 'views_random_seed_handler_sort_random',
),
);
return $data;
}
/**
* Implementation of hook_views_handlers() to register the random seed handler.
*/
function views_random_seed_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'views_random_seed'),
),
'handlers' => array(
'views_random_seed_handler_sort_random' => array(
'parent' => 'views_handler_sort',
),
),
);
}
Functions
Name | Description |
---|---|
views_random_seed_views_data | Implementation of hook_views_data() |
views_random_seed_views_handlers | Implementation of hook_views_handlers() to register the random seed handler. |