class Table

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

Plugin annotation

@BootstrapPreprocess("table")

Hierarchy

Expanded class hierarchy of Table

Related topics

Namespace

Drupal\bootstrap\Plugin\Preprocess
Source
class Table extends PreprocessBase {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members

Contains filters are case sensitive
Name Modifiers Type Description
PluginBase::$theme protected property The currently set theme object.
PluginBase::__construct public function
PreprocessBase::$hook protected property The theme hook invoked.
PreprocessBase::$info protected property The theme hook info array from the theme registry.
PreprocessBase::$variables protected property The Variables object.
PreprocessBase::preprocess public function Preprocess theme hook variables. Overrides PreprocessInterface::preprocess
PreprocessBase::preprocessAttributes protected function Ensures all attributes have been converted to an Attribute object.
PreprocessBase::preprocessDescription protected function Converts any set description variable into a traversable array.
PreprocessBase::preprocessElement protected function Preprocess the variables array if an element is present.
Table::preprocessVariables public function Preprocess the variables array. Overrides PreprocessBase::preprocessVariables