function farm_theme_views_bulk_operations_form_alter in farmOS 7
Implements hook_views_bulk_operations_form_alter().
File
- themes/
farm_theme/ template.php, line 189 - Farm theme template.php.
Code
function farm_theme_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) {
// Add some JavaScript that enhances VBO.
drupal_add_js(drupal_get_path('theme', 'farm_theme') . '/js/vbo.js');
// Move VBO buttons to the bottom.
$form['select']['#weight'] = 100;
// Move the certain actions to the end of the list.
$end_actions = array(
'action::farm_map_kml_action',
'action::farm_flags_action',
'action::farm_log_assign_action',
'action::farm_group_asset_membership_action',
'action::farm_asset_archive_action',
'action::farm_asset_unarchive_action',
'action::farm_asset_clone_action',
'action::log_clone_action',
'action::views_bulk_operations_delete_item',
);
$i = 0;
foreach ($end_actions as $action) {
$form['select'][$action]['#weight'] = 100 + $i;
$i++;
}
// If we are viewing a VBO config or confirm form, add Javascript that will
// hide everything on the page except for the form.
$vbo_steps = array(
'views_bulk_operations_config_form',
'views_bulk_operations_confirm_form',
);
if (!empty($form_state['step']) && in_array($form_state['step'], $vbo_steps)) {
// Set the title to '<none>' so that Views doesn't do drupal_set_title().
// See https://www.drupal.org/node/2905171.
$vbo->view
->set_title('<none>');
// Add some information to Javascript settings.
$settings = array(
'vbo_hide' => TRUE,
'view_name' => $vbo->view->name,
'view_display' => $vbo->view->current_display,
);
drupal_add_js(array(
'farm_theme' => $settings,
), 'setting');
}
}