Projet

Général

Profil

Paste
Télécharger (1,24 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views_bulk_operations / views_bulk_operations.api.php @ 87dbc3bf

1
<?php
2

    
3
/**
4
 * @file
5
 * Hooks provided by Views Bulk Operations.
6
 */
7

    
8
/**
9
 * Perform alterations on the VBO form before it is rendered.
10
 *
11
 * Usually, if a module wanted to alter the VBO form through hook_form_alter(),
12
 * it would need to duplicate the views form checks from
13
 * views_bulk_operations_form_alter(), while making sure that the hook
14
 * runs after VBO's hook (by increasing the weight of the altering module's
15
 * system entry). In order to reduce that complexity, VBO provides this hook.
16
 *
17
 * @param $form
18
 *  A step of the VBO form to be altered.
19
 * @param $form_state
20
 *  Form state. Contains the name of the current step in $form_state['step'].
21
 * @param $vbo
22
 *   The VBO views field. Contains a reference to the view in $vbo->view.
23
 */
24
function hook_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) {
25
  if ($form_state['step'] == 'views_form_views_form') {
26
    // Alter the first step of the VBO form (the selection page).
27
    $form['select']['#title'] = t('Bulk operations');
28
  }
29
  elseif ($form_state['step'] == 'views_bulk_operations_config_form') {
30
    // Alter the configuration step of the VBO form.
31
  }
32
  elseif ($form_state['step'] == 'views_bulk_operations_confirm_form') {
33
    // Alter the confirmation step of the VBO form.
34
  }
35
}