3 namespace Drupal\bootstrap\Plugin\Preprocess;
5 use Drupal\bootstrap\Bootstrap;
6 use Drupal\bootstrap\Utility\Element;
7 use Drupal\bootstrap\Utility\Variables;
10 * Pre-processes variables for the "tablesort_indicator" theme hook.
12 * @ingroup plugins_preprocess
14 * @BootstrapPreprocess("tablesort_indicator")
16 class TableSortIndicator extends PreprocessBase implements PreprocessInterface {
21 public function preprocessVariables(Variables $variables) {
22 if ($variables->style === 'asc') {
23 $icon = Element::createStandalone(Bootstrap::glyphicon('chevron-down', ['#markup' => $this->t('(asc)')]))
24 ->addClass('icon-after')
26 'data-toggle' => 'tooltip',
27 'data-placement' => 'bottom',
28 'title' => $this->t('Sort ascending'),
32 $icon = Element::createStandalone(Bootstrap::glyphicon('chevron-up', ['#markup' => $this->t('(desc)')]))
33 ->addClass('icon-after')
35 'data-toggle' => 'tooltip',
36 'data-placement' => 'bottom',
37 'title' => $this->t('Sort descending'),
40 $variables->icon = $icon->getArray();