Problem/Motivation

#3494015: Link render element overwrites CSS class fixed a bug where Link options and attributes where not merged. However, Url attributes class is now no longer output as they are overwritten by Link attributes class even when Link has none.

Steps to reproduce

  $url = Url::fromRoute('user.login')->setOption('attributes', [
      'class' => ['button'],
    ]);
  $link = Link::fromTextAndUrl(t('Log in'), $url)->toString();

Proposed resolution

Merge Link options, Link attributes and Url options when rendering Link

Remaining tasks

  1. Write a merge request
  2. Review
  3. Commit

User interface changes

\Drupal\Core\Url attributes class are printed

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

-

Comments

idebr created an issue.