function theme_views_bulk_operations_select_all in Views Bulk Operations (VBO) 7.3
Same name and namespace in other branches
- 6 views_bulk_operations.module \theme_views_bulk_operations_select_all()
Returns the 'select all' div that gets inserted below the table header row (for table style plugins with grouping disabled), or above the view results (for non-table style plugins), providing a choice between selecting items on the current page, and on all pages.
The actual insertion is done by JS, matching the degradation behavior of Drupal core (no JS - no select all).
1 theme call to theme_views_bulk_operations_select_all()
- views_bulk_operations_form in ./
views_bulk_operations.module - Extend the views_form multistep form with elements for executing an operation.
File
- ./
views_bulk_operations.module, line 396 - Allows operations to be performed on items selected in a view.
Code
function theme_views_bulk_operations_select_all($variables) {
$view = $variables['view'];
$enable_select_all_pages = $variables['enable_select_all_pages'];
$enable_select_this_page = $variables['enable_select_this_page'];
$form = array();
if ($view->style_plugin instanceof views_plugin_style_table && empty($view->style_plugin->options['grouping'])) {
if (!$enable_select_all_pages) {
return '';
}
$wrapper_class = 'vbo-table-select-all-markup';
$this_page_count = format_plural(count($view->result), '1 row', '@count rows');
$this_page = t('Selected <strong>!row_count</strong> in this page.', array(
'!row_count' => $this_page_count,
));
$all_pages_count = format_plural($view->total_rows, '1 row', '@count rows');
$all_pages = t('Selected <strong>!row_count</strong> in this view.', array(
'!row_count' => $all_pages_count,
));
$form['select_all_pages'] = array(
'#type' => 'button',
'#attributes' => array(
'class' => array(
'vbo-table-select-all-pages',
),
),
'#value' => t('Select all !row_count in this view.', array(
'!row_count' => $all_pages_count,
)),
'#prefix' => '<span class="vbo-table-this-page">' . $this_page . ' ',
'#suffix' => '</span>',
);
if ($enable_select_this_page) {
$form['select_this_page'] = array(
'#type' => 'button',
'#attributes' => array(
'class' => array(
'vbo-table-select-this-page',
),
),
'#value' => t('Select only !row_count in this page.', array(
'!row_count' => $this_page_count,
)),
'#prefix' => '<span class="vbo-table-all-pages" style="display: none">' . $all_pages . ' ',
'#suffix' => '</span>',
);
}
}
else {
$wrapper_class = 'vbo-select-all-markup';
if ($enable_select_all_pages || $enable_select_this_page) {
$form['select_all'] = array(
'#type' => 'fieldset',
'#attributes' => array(
'class' => array(
'vbo-fieldset-select-all',
),
),
);
}
if ($enable_select_this_page) {
$form['select_all']['this_page'] = array(
'#type' => 'checkbox',
'#title' => t('Select all items on this page'),
'#default_value' => '',
'#attributes' => array(
'class' => array(
'vbo-select-this-page',
),
),
);
}
if ($enable_select_all_pages && $enable_select_this_page) {
$form['select_all']['or'] = array(
'#type' => 'markup',
'#markup' => '<em>' . t('OR') . '</em>',
);
}
if ($enable_select_all_pages) {
$form['select_all']['all_pages'] = array(
'#type' => 'checkbox',
'#title' => t('Select all items on all pages'),
'#default_value' => '',
'#attributes' => array(
'class' => array(
'vbo-select-all-pages',
),
),
);
}
}
$output = '<div class="' . $wrapper_class . '">';
$output .= drupal_render($form);
$output .= '</div>';
return $output;
}