1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Passes selected ids as arguments to a page.
|
6 |
|
|
* The ids might be entity ids or revision ids, depending on the type of the
|
7 |
|
|
* VBO field.
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
/**
|
11 |
|
|
* Implementation of hook_action_info().
|
12 |
|
|
*/
|
13 |
|
|
function views_bulk_operations_argument_selector_action_info() {
|
14 |
|
|
return array(
|
15 |
|
|
'views_bulk_operations_argument_selector_action' => array(
|
16 |
|
|
'label' => t('Pass ids as arguments to a page'),
|
17 |
|
|
'type' => 'entity',
|
18 |
|
|
'aggregate' => TRUE,
|
19 |
|
|
'configurable' => FALSE,
|
20 |
|
|
'hooks' => array(),
|
21 |
|
|
'triggers' => array('any'),
|
22 |
|
|
),
|
23 |
|
|
);
|
24 |
|
|
}
|
25 |
|
|
|
26 |
|
|
/**
|
27 |
|
|
* Implementation of a Drupal action.
|
28 |
|
|
* Passes selected ids as arguments to a view.
|
29 |
|
|
*/
|
30 |
|
|
function views_bulk_operations_argument_selector_action($entities, $context = array()) {
|
31 |
|
|
$base_url = $context['settings']['url'];
|
32 |
|
|
$arguments = implode(',', array_keys($entities));
|
33 |
|
|
// Add a trailing slash if missing.
|
34 |
|
|
if (substr($base_url, -1, 1) != '/') {
|
35 |
|
|
$base_url .= '/';
|
36 |
|
|
}
|
37 |
|
|
drupal_goto($base_url . $arguments);
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
function views_bulk_operations_argument_selector_action_views_bulk_operations_form($options) {
|
41 |
|
|
$form['url'] = array(
|
42 |
|
|
'#title' => t('URL'),
|
43 |
|
|
'#type' => 'textfield',
|
44 |
|
|
'#description' => t('Enter a URL that the user will be sent to. A comma-separated list of selected ids will be appended.'),
|
45 |
|
|
'#default_value' => isset($options['url']) ? $options['url'] : '',
|
46 |
|
|
'#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
|
47 |
|
|
);
|
48 |
|
|
return $form;
|
49 |
|
|
} |