$lang = \Drupal::service('language_manager') ->getCurrentLanguage() ->getId(); $current_route_name = \Drupal::service('current_route_match') ->getRouteName(); $filter_all_text = t('Todo'); $filter_all_url = Url::fromRoute($current_route_name); $filter_all_url->setOptions([ 'attributes' => [ 'class' => [ 'btn-main-filter', ], ], ]);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter