Skip to content
Snippets Groups Projects

Issue #3441789 by adinac, mark_fullmer: Link attributes are not set for linkit...

Merged Mark Fullmer requested to merge issue/linkit-3441789:3441789-link-attributes-are into 6.1.x
1 file
+ 3
0
Compare changes
  • Side-by-side
  • Inline
@@ -110,6 +110,8 @@ class LinkitFormatter extends LinkFormatter {
foreach ($elements as $delta => &$item) {
/** @var \Drupal\link\LinkItemInterface $link_item */
$link_item = $items->get($delta);
$item_url = $this->buildUrl($link_item);
$item_url_attributes = $item_url->getOption('attributes');
if ($url = $this->getSubstitutedUrl($link_item)) {
if ($url instanceof CacheableDependencyInterface) {
$cacheable_url = $url;
@@ -131,6 +133,7 @@ class LinkitFormatter extends LinkFormatter {
$url->setOption('fragment', $parsed_url['fragment']);
}
$attributes = (array) $url->getOption('attributes');
$attributes = array_merge($item_url_attributes ?: [], $attributes ?: []);
// Restore rel and target options.
if (!empty($settings['rel'])) {
$attributes['rel'] = $settings['rel'];
Loading