views_bulk_operations.api.php 1.2 KB

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