1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- /**
- * @file
- * Allows operations to be performed on items selected in a view.
- */
- use Drupal\Core\Routing\RouteMatchInterface;
- /**
- * Implements hook_views_data_alter().
- */
- function views_bulk_operations_views_data_alter(&$data) {
- $data['views']['views_bulk_operations_bulk_form'] = [
- 'title' => t('Views bulk operations'),
- 'help' => t("Process entities returned by the view with Views Bulk Operations' actions."),
- 'field' => [
- 'id' => 'views_bulk_operations_bulk_form',
- ],
- ];
- }
- /**
- * Implements hook_help().
- */
- function views_bulk_operations_help($route_name, RouteMatchInterface $route_match) {
- switch ($route_name) {
- case 'help.page.views_bulk_operations':
- $filepath = dirname(__FILE__) . '/README.txt';
- if (file_exists($filepath)) {
- $readme = file_get_contents($filepath);
- $output = '<pre>' . $readme . '</pre>';
- return $output;
- }
- }
- }
- /**
- * Implements hook_preprocess_THEME().
- */
- function views_bulk_operations_preprocess_views_view_table(&$variables) {
- if (!empty($variables['view']->style_plugin->options['views_bulk_operations_enabled'])) {
- // Add module own class to improve resistance to theme overrides.
- $variables['attributes']['class'][] = 'vbo-table';
- }
- }
|