I'm generating a URL with
Is there a way to add automatically an "active" class, like D7, if the page is the same of the URL?
Obviously without check manually the value of the generated URL and the page.
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
In the documentation is not present, but on $options array we can simply set "set_active_class" to TRUE (FALSE by default) and then drupal add a "is-active" class to the link:
Url::fromUri('internal:/progetti/selezionati', array('set_active_class' => TRUE)),
I think that this behaviour should be TRUE by default..