Updated the Bootstrap theme.
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Preprocess / TableSortIndicator.php
1 <?php
2
3 namespace Drupal\bootstrap\Plugin\Preprocess;
4
5 use Drupal\bootstrap\Bootstrap;
6 use Drupal\bootstrap\Utility\Element;
7 use Drupal\bootstrap\Utility\Variables;
8
9 /**
10  * Pre-processes variables for the "tablesort_indicator" theme hook.
11  *
12  * @ingroup plugins_preprocess
13  *
14  * @BootstrapPreprocess("tablesort_indicator")
15  */
16 class TableSortIndicator extends PreprocessBase implements PreprocessInterface {
17
18   /**
19    * {@inheritdoc}
20    */
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')
25         ->setAttributes([
26           'data-toggle' => 'tooltip',
27           'data-placement' => 'bottom',
28           'title' => $this->t('Sort ascending'),
29         ]);
30     }
31     else {
32       $icon = Element::createStandalone(Bootstrap::glyphicon('chevron-up', ['#markup' => $this->t('(desc)')]))
33         ->addClass('icon-after')
34         ->setAttributes([
35           'data-toggle' => 'tooltip',
36           'data-placement' => 'bottom',
37           'title' => $this->t('Sort descending'),
38         ]);
39     }
40     $variables->icon = $icon->getArray();
41   }
42
43 }