Skip to content

Commit

Permalink
Set link target to _blank
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Feb 16, 2024
1 parent b037aa8 commit 4dd3e44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/TermLinkGenerator/FallbackTermLinkGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function generate(TermsInterface $terms, ?string $locale = null): string
$link = $this->urlGenerator->generate('setono_sylius_terms_show', ['slug' => $slug]);

return sprintf(
'<a href="%s" data-generator="fallback">%s</a>',
'<a href="%s" data-generator="fallback" target="_blank">%s</a>',
$link,
(string) $label,
);
Expand Down
4 changes: 2 additions & 2 deletions src/TermLinkGenerator/MarkdownTermLinkGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function generate(TermsInterface $terms, ?string $locale = null): string
$label = (string) $terms->getTranslation($locale)->getLabel();
$link = $this->router->generate('setono_sylius_terms_show', ['slug' => $slug]);

return (string) preg_replace_callback('/\[link:(.*?)\]/', fn ($matches): string => sprintf(
'<a href="%s" data-generator="markdown">%s</a>',
return (string) preg_replace_callback('/\[link:(.*?)\]/', static fn ($matches): string => sprintf(
'<a href="%s" data-generator="markdown" target="_blank">%s</a>',
$link,
$matches[1],
), htmlspecialchars($label));
Expand Down

0 comments on commit 4dd3e44

Please sign in to comment.