diff --git a/src/Plugin/views/area/DisplaySwitch.php b/src/Plugin/views/area/DisplaySwitch.php index e1050af4768b0eea048913ee83c1c1784ef93bab..c8caaf671b883edd60f533d80d41917be9f15120 100644 --- a/src/Plugin/views/area/DisplaySwitch.php +++ b/src/Plugin/views/area/DisplaySwitch.php @@ -230,6 +230,9 @@ class DisplaySwitch extends AreaPluginBase { return [ '#theme' => 'views_display_switch', '#links' => $links, + '#attributes' => [ + 'class' => ['views-display-switch'], + ], ]; } diff --git a/templates/views-display-switch.html.twig b/templates/views-display-switch.html.twig index 781d6cb462f7523d01ba8dd96a1a3623beff2bc8..fcea87a24bfa3d13725395b264e06dade7981d56 100644 --- a/templates/views-display-switch.html.twig +++ b/templates/views-display-switch.html.twig @@ -1,6 +1,6 @@ <!-- Add you custom twig html here --> -<div class="views-display-switch"> +<div {{ attributes }}> {% for link in links %} {{ link }} - {% endfor%} + {% endfor %} </div> diff --git a/views_display_switch.module b/views_display_switch.module index 047a8e8459997d614563a0dbc3e0c378c03efaca..a08251608d0e27804bfbee5d8692bb89bf2a7260 100644 --- a/views_display_switch.module +++ b/views_display_switch.module @@ -33,6 +33,7 @@ function views_display_switch_theme() { 'render element' => 'children', 'variables' => [ 'links' => [], + 'attributes' => [], ], ], ];