function views_bulk_operations_handler_field_operations::views_form in Views Bulk Operations (VBO) 7.3
The form which replaces the placeholder from render().
File
- views/
views_bulk_operations_handler_field_operations.inc, line 282 - Views field handler. Contains all relevant VBO options and related logic. Implements the Views Form API.
Class
- views_bulk_operations_handler_field_operations
- @file Views field handler. Contains all relevant VBO options and related logic. Implements the Views Form API.
Code
function views_form(&$form, &$form_state) {
// The view is empty, abort.
if (empty($this->view->result)) {
return;
}
$form[$this->options['id']] = array(
'#tree' => TRUE,
);
// At this point, the query has already been run, so we can access the results
// in order to get the base key value (for example, nid for nodes).
foreach ($this->view->result as $row_index => $row) {
$this->view->row_index = $row_index;
$id = $this
->get_value($row, $this->real_field);
if ($this->options['vbo_settings']['force_single']) {
$form[$this->options['id']][$row_index] = array(
'#type' => 'radio',
'#parents' => array(
$this->options['id'],
),
'#return_value' => $id,
'#attributes' => array(
'class' => array(
'vbo-select',
),
),
);
}
else {
$form[$this->options['id']][$row_index] = array(
'#type' => 'checkbox',
'#return_value' => $id,
'#default_value' => FALSE,
'#attributes' => array(
'class' => array(
'vbo-select',
),
),
);
}
}
}