-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobin.module
45 lines (37 loc) · 1.08 KB
/
robin.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Implements hook_menu().
*/
function robin_menu() {
$items = array();
$items['admin/config/administration/robin'] = array(
'type' => MENU_NORMAL_ITEM,
'access arguments' => array('administer site configuration'),
'page callback' => 'drupal_get_form',
'page arguments' => array('robin_admin_form'),
'title' => 'Robin admin',
'description' => 'Change settings for the robin module',
);
return $items;
}
/**
* Admin for robin module.
*/
function robin_admin_form($form, &$form_state) {
$form['robin_num_items_blog'] = array(
'#type' => 'select',
'#title' => t('Number of items per block'),
'#description' => t('Description'),
'#options' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
'#default_value' => variable_get('robin_num_items_blog', 5),
);
return system_settings_form($form);
}
/**
* Implements hook_views_pre_build().
*/
function robin_views_pre_build(&$view) {
if (($view->name == 'blog') && ($view->current_display == 'block')) {
$view->items_per_page = variable_get('robin_num_items_blog', 5);
}
}