1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * Provide views handlers and plugins that allow usage of PHP. |
---|
6 | */ |
---|
7 | |
---|
8 | /** |
---|
9 | * Implements hook_views_data(). |
---|
10 | */ |
---|
11 | function views_php_views_data() { |
---|
12 | $data['views']['php'] = array( |
---|
13 | 'title' => t('PHP'), |
---|
14 | 'help' => t('Use PHP code.'), |
---|
15 | 'area' => array( |
---|
16 | 'help' => t('Use PHP code to construct the output of an area.'), |
---|
17 | 'handler' => 'views_php_handler_area', |
---|
18 | ), |
---|
19 | 'field' => array( |
---|
20 | 'help' => t('Use PHP code to construct the output of a field.'), |
---|
21 | 'handler' => 'views_php_handler_field', |
---|
22 | ), |
---|
23 | 'filter' => array( |
---|
24 | 'help' => t('Use PHP code to filter the result of the view.'), |
---|
25 | 'handler' => 'views_php_handler_filter', |
---|
26 | ), |
---|
27 | 'sort' => array( |
---|
28 | 'help' => t('Use PHP code to sort the result of the view.'), |
---|
29 | 'handler' => 'views_php_handler_sort', |
---|
30 | ), |
---|
31 | ); |
---|
32 | return $data; |
---|
33 | } |
---|
34 | |
---|
35 | /** |
---|
36 | * Implements hook_views_handlers(). |
---|
37 | */ |
---|
38 | function views_php_views_handlers() { |
---|
39 | $handlers = array( |
---|
40 | 'info' => array( |
---|
41 | 'path' => drupal_get_path('module', 'views_php') . '/plugins/views', |
---|
42 | ), |
---|
43 | 'handlers' => array( |
---|
44 | 'views_php_handler_field' => array( |
---|
45 | 'parent' => 'views_handler_field', |
---|
46 | ), |
---|
47 | 'views_php_handler_filter' => array( |
---|
48 | 'parent' => 'views_handler_filter', |
---|
49 | ), |
---|
50 | 'views_php_handler_sort' => array( |
---|
51 | 'parent' => 'views_handler_sort', |
---|
52 | ), |
---|
53 | 'views_php_handler_area' => array( |
---|
54 | 'parent' => 'views_handler_area', |
---|
55 | ), |
---|
56 | ), |
---|
57 | ); |
---|
58 | return $handlers; |
---|
59 | } |
---|
60 | |
---|
61 | /** |
---|
62 | * Implements hook_views_plugins(). |
---|
63 | */ |
---|
64 | function views_php_views_plugins() { |
---|
65 | $plugins = array( |
---|
66 | 'access' => array( |
---|
67 | 'php' => array( |
---|
68 | 'title' => t('PHP'), |
---|
69 | 'help' => t('Use PHP code to grant access.'), |
---|
70 | 'handler' => 'views_php_plugin_access', |
---|
71 | 'uses options' => TRUE, |
---|
72 | 'path' => drupal_get_path('module', 'views_php') . '/plugins/views', |
---|
73 | 'help topic' => 'access-php', |
---|
74 | ), |
---|
75 | ), |
---|
76 | 'cache' => array( |
---|
77 | 'php' => array( |
---|
78 | 'title' => t('PHP'), |
---|
79 | 'help' => t('Use PHP code to determine whether a view should be cached.'), |
---|
80 | 'handler' => 'views_php_plugin_cache', |
---|
81 | 'uses options' => TRUE, |
---|
82 | 'path' => drupal_get_path('module', 'views_php') . '/plugins/views', |
---|
83 | 'help topic' => 'cache-php', |
---|
84 | ), |
---|
85 | ), |
---|
86 | ); |
---|
87 | return $plugins; |
---|
88 | } |
---|