Skip to content

Commit

Permalink
fix: make the # link stays at the current page
Browse files Browse the repository at this point in the history
  • Loading branch information
BaoNguyen09 committed Dec 9, 2024
1 parent 8a41325 commit 3b112a4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
$link_url = Url::fromUri(urldecode('base:' . $item->link_uri));
}
else {
$link_url = $this->pathValidator->getUrlIfValid($item->link_uri ?? '<none>');
if (strcmp($item->link_uri, "#") == 0) {
$link_url = $this->pathValidator->getUrlIfValid('<none>');
} else {
$link_url = $this->pathValidator->getUrlIfValid($item->link_uri ?? '<none>');
}
}
$link_render_array = [
'#type' => 'link',
Expand Down

0 comments on commit 3b112a4

Please sign in to comment.