function farm_constraint_views_bulk_operations_form_alter in farmOS 7
Implements hook_views_bulk_operations_form_alter().
File
- modules/
farm/ farm_constraint/ farm_constraint.module, line 256 - Farm constraint module.
Code
function farm_constraint_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) {
// Add the entity type as a form value, for use in validation.
if (!empty($vbo->entity_type)) {
$form['farm_constraint_entity_type'] = array(
'#type' => 'value',
'#value' => $vbo->entity_type,
);
}
// Add a validation function to the submit button which checks for
// constraints before deleting entities.
if ($vbo
->get_vbo_option('display_type') == 0) {
$form['select']['submit']['#validate'][] = 'farm_constraint_views_bulk_operations_form_validate';
}
else {
if (!empty($form['select']['action::views_bulk_operations_delete_item'])) {
$form['select']['action::views_bulk_operations_delete_item']['#validate'][] = 'farm_constraint_views_bulk_operations_form_validate';
}
}
}