elseif (isset($element['#id'
])) { $element['#options'
]['attributes'
]['id'
] =
$element['#id'
];
} // Conditionally invoke self::preRenderAjaxForm(), if #ajax is set.
if (isset($element['#ajax'
]) && !
isset($element['#ajax_processed'
])) { // If no HTML ID was found above, automatically create one.
if (!
isset($element['#id'
])) { $element['#id'
] =
$element['#options'
]['attributes'
]['id'
] = HtmlUtility::
getUniqueId('ajax-link'
);
} $element =
static::
preRenderAjaxForm($element);
} if (!
empty($element['#url'
]) &&
$element['#url'
] instanceof CoreUrl
) { $options = NestedArray::
mergeDeep($element['#url'
]->
getOptions(),
$element['#options'
]);
/** @var \Drupal\Core\Utility\LinkGenerator $link_generator */
$link_generator = \Drupal::
service('link_generator'
);
$generated_link =
$link_generator->
generate($element['#title'
],
$element['#url'
]->
setOptions($options));
$element['#markup'
] =
$generated_link;
$generated_link->
merge(BubbleableMetadata::
createFromRenderArray($element)) ->
applyTo($element);
}