3 namespace Drupal\bootstrap\Plugin\Preprocess;
5 use Drupal\bootstrap\Utility\Element;
6 use Drupal\bootstrap\Utility\Variables;
9 * Pre-processes variables for the "links" theme hook.
11 * @ingroup plugins_preprocess
13 * @BootstrapPreprocess("links")
15 class Links extends PreprocessBase implements PreprocessInterface {
20 public function preprocessVariables(Variables $variables) {
21 if ($variables->theme_hook_original === 'links' && $variables->hasClass('operations')) {
22 $variables->addClass('list-inline');
23 foreach ($variables->links as &$data) {
24 $link = Element::create($data['link']);
25 $link->addClass(['btn', 'btn-sm']);
28 if ($this->theme->getSetting('tooltip_enabled')) {
29 $link->setAttribute('data-toggle', 'tooltip');
30 $link->setAttribute('data-placement', 'bottom');
34 $this->preprocessAttributes();