You are here

public function ViewsBulkOperationsBulkForm::preRender in Views Bulk Operations (VBO) 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/field/ViewsBulkOperationsBulkForm.php \Drupal\views_bulk_operations\Plugin\views\field\ViewsBulkOperationsBulkForm::preRender()
  2. 8 src/Plugin/views/field/ViewsBulkOperationsBulkForm.php \Drupal\views_bulk_operations\Plugin\views\field\ViewsBulkOperationsBulkForm::preRender()
  3. 8.2 src/Plugin/views/field/ViewsBulkOperationsBulkForm.php \Drupal\views_bulk_operations\Plugin\views\field\ViewsBulkOperationsBulkForm::preRender()

Runs before any fields are rendered.

This gives the handlers some time to set up before any handler has been rendered.

Parameters

\Drupal\views\ResultRow[] $values: An array of all ResultRow objects returned from the query.

Overrides FieldPluginBase::preRender

File

src/Plugin/views/field/ViewsBulkOperationsBulkForm.php, line 577

Class

ViewsBulkOperationsBulkForm
Defines the Views Bulk Operations field plugin.

Namespace

Drupal\views_bulk_operations\Plugin\views\field

Code

public function preRender(&$values) {
  parent::preRender($values);

  // Add empty classes if there are no actions available.
  if (empty($this
    ->getBulkOptions())) {
    $this->options['element_label_class'] .= 'empty';
    $this->options['element_class'] .= 'empty';
    $this->options['element_wrapper_class'] .= 'empty';
    $this->options['label'] = '';
  }
  elseif (!empty($this->view->style_plugin) && $this->view->style_plugin instanceof Table) {

    // Add the tableselect css classes.
    $this->options['element_label_class'] .= 'select-all';

    // Hide the actual label of the field on the table header.
    $this->options['label'] = '';
  }
}