You are here

public function Table::preprocessVariables in Express 8

Preprocess the variables array.

Parameters

\Drupal\bootstrap\Utility\Variables $variables: The Variables object.

Overrides PreprocessBase::preprocessVariables

File

themes/contrib/bootstrap/src/Plugin/Preprocess/Table.php, line 24
Contains \Drupal\bootstrap\Plugin\Preprocess\Table.

Class

Table
Pre-processes variables for the "table" theme hook.

Namespace

Drupal\bootstrap\Plugin\Preprocess

Code

public function preprocessVariables(Variables $variables) {

  // Bordered.
  $variables['bordered'] = !!$variables
    ->getContext('bordered', $this->theme
    ->getSetting('table_bordered'));

  // Condensed.
  $variables['condensed'] = !!$variables
    ->getContext('condensed', $this->theme
    ->getSetting('table_condensed'));

  // Hover.
  $variables['hover'] = !!$variables
    ->getContext('hover', $this->theme
    ->getSetting('table_hover'));

  // Striped.
  $variables['striped'] = empty($variables['no_striping']) && $variables
    ->getContext('striped', $this->theme
    ->getSetting('table_striped'));
  unset($variables['no_striping']);

  // Responsive.
  $responsive = $variables
    ->getContext('responsive', $this->theme
    ->getSetting('table_responsive'));
  $variables['responsive'] = $responsive == -1 ? !\Drupal::service('router.admin_context')
    ->isAdminRoute() : !!(int) $responsive;
}