4 * Contains \Drupal\bootstrap\Plugin\Preprocess\Links.
7 namespace Drupal\bootstrap\Plugin\Preprocess;
9 use Drupal\bootstrap\Annotation\BootstrapPreprocess;
10 use Drupal\bootstrap\Utility\Element;
11 use Drupal\bootstrap\Utility\Variables;
14 * Pre-processes variables for the "links" theme hook.
16 * @ingroup plugins_preprocess
18 * @BootstrapPreprocess("links")
20 class Links extends PreprocessBase implements PreprocessInterface {
25 public function preprocessVariables(Variables $variables) {
26 if ($variables->theme_hook_original === 'links' && $variables->hasClass('operations')) {
27 $variables->addClass('list-inline');
28 foreach ($variables->links as &$data) {
29 $link = Element::create($data['link']);
30 $link->addClass(['btn', 'btn-sm']);
33 if ($this->theme->getSetting('tooltip_enabled')) {
34 $link->setAttribute('data-toggle', 'tooltip');
35 $link->setAttribute('data-placement', 'bottom');
39 $this->preprocessAttributes();