Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

#99301 - skip rendering href tag on empty custom_url content #583

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ USE GITHUB ISSUE/PULL REQUEST NUMBERS, NOT INTERNAL ONE

## [Unreleased]
### Added
- skip rendering href tag on empty content in `custom_url`
### Changed
### Fixed
### Removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$title = $block->getTitle();
$imageUrl = $block->getImageUrl();
$imageAltText = $block->getImageAltText();
$content = $block->getContent();
if ($block->getId()) {
$attributes[] = 'data-menu="menu-' . $block->getId() . '"';
}
Expand All @@ -17,7 +18,9 @@
}
?>
<a
href="<?= $block->escapeUrl($block->getContent()) ?>"
<?php if ($content): ?>
href="<?= $block->escapeUrl($content) ?>"
<?php endif; ?>
<?= /* @noEscape */ implode(' ', $attributes) ?>
>
<?= $block->escapeHtml($title) ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
$class = $block->getMenuClass();
$classLink = $block->getIsRoot() ? $class . '__label' : 'link footer__link';
$title = $block->getTitle();
$content = $block->getContent();
if ($block->getId()) {
$attributes[] = 'aria-controls="dropdown-' . $block->getId() . '"';
}
Expand Down Expand Up @@ -31,7 +32,9 @@
</button>
<?php else: ?>
<a
href="<?= $block->escapeUrl($block->getContent()) ?>"
<?php if ($content): ?>
href="<?= $block->escapeUrl($content) ?>"
<?php endif; ?>
class="<?= $block->escapeHtmlAttr($classLink) ?>"
>
<?= $block->escapeHtml($title) ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
$class = $block->getMenuClass();
$isViewAllLink = $block->getIsViewAllLink();
$isContent = $block->getIsParent();

$content = $block->getContent();

if ($isViewAllLink) {
$title = __('View All');
$classLink = $class . '__label link--invert';
Expand All @@ -23,7 +24,9 @@
}
?>
<a
href="<?= $block->escapeUrl($block->getContent()) ?>"
<?php if ($content): ?>
href="<?= $block->escapeUrl($content) ?>"
<?php endif; ?>
<?= /* @noEscape */ implode(' ', $attributes) ?>
<?php if (!$isViewAllLink && $isContent): ?>
role="button"
Expand Down