4 * Contains \Drupal\bootstrap\Plugin\Preprocess\Table.
7 namespace Drupal\bootstrap\Plugin\Preprocess;
9 use Drupal\bootstrap\Annotation\BootstrapPreprocess;
10 use Drupal\bootstrap\Utility\Variables;
13 * Pre-processes variables for the "table" theme hook.
15 * @ingroup plugins_preprocess
17 * @BootstrapPreprocess("table")
19 class Table extends PreprocessBase {
24 public function preprocessVariables(Variables $variables) {
26 $variables['bordered'] = !!$variables->getContext('bordered', $this->theme->getSetting('table_bordered'));
29 $variables['condensed'] = !!$variables->getContext('condensed', $this->theme->getSetting('table_condensed'));
32 $variables['hover'] = !!$variables->getContext('hover', $this->theme->getSetting('table_hover'));
35 $variables['striped'] = empty($variables['no_striping']) && $variables->getContext('striped', $this->theme->getSetting('table_striped'));
36 unset($variables['no_striping']);
39 $responsive = $variables->getContext('responsive', $this->theme->getSetting('table_responsive'));
40 $variables['responsive'] = $responsive == -1 ? !\Drupal::service('router.admin_context')->isAdminRoute() : !!(int) $responsive;