file Table.php

Namespace

Drupal\bootstrap\Plugin\Preprocess
  1. <?php
  2. namespace Drupal\bootstrap\Plugin\Preprocess;
  3. use Drupal\bootstrap\Utility\Variables;
  4. /**
  5. * Pre-processes variables for the "table" theme hook.
  6. *
  7. * @ingroup plugins_preprocess
  8. *
  9. * @BootstrapPreprocess("table")
  10. */
  11. class Table extends PreprocessBase {
  12. /**
  13. * {@inheritdoc}
  14. */
  15. public function preprocessVariables(Variables $variables) {
  16. // Bordered.
  17. $variables['bordered'] = !!$variables->getContext('bordered', $this->theme->getSetting('table_bordered'));
  18. // Condensed.
  19. $variables['condensed'] = !!$variables->getContext('condensed', $this->theme->getSetting('table_condensed'));
  20. // Hover.
  21. $variables['hover'] = !!$variables->getContext('hover', $this->theme->getSetting('table_hover'));
  22. // Striped.
  23. $variables['striped'] = empty($variables['no_striping']) && $variables->getContext('striped', $this->theme->getSetting('table_striped'));
  24. unset($variables['no_striping']);
  25. // Responsive.
  26. $responsive = $variables->getContext('responsive', $this->theme->getSetting('table_responsive'));
  27. $variables['responsive'] = $responsive == -1 ? !\Drupal::service('router.admin_context')->isAdminRoute() : !!(int) $responsive;
  28. }
  29. }

Classes

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