Skip to content

Commit

Permalink
Merge pull request #282 from SnowdogApps/feature/100390
Browse files Browse the repository at this point in the history
Feature/100390
  • Loading branch information
Jarek Krupiński authored Jul 25, 2023
2 parents e4a5449 + b515f01 commit 13736e5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Changed
- Update GH actions to github-actions-m2 and small code fixes to standards (#100322)
- Don't show <a> tag when there's no url (DEV-100390)
- Fixed issue about menu block being cached excessively ([#276](https://github.com/SnowdogApps/magento2-menu/issues/276))

## [2.22.0] - 2023-05-08
Expand Down
25 changes: 17 additions & 8 deletions view/frontend/templates/menu/node_type/custom_url.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ $class = $block->getMenuClass();
$imageUrl = $block->getImageUrl();
$imageAltText = $block->getImageAltText();
$content = $block->getContent();

if ($block->getIsViewAllLink()) {
$title = __('View All');
$classLink = $class . '__inner-link';
Expand All @@ -20,16 +21,24 @@ $attributes[] = 'class="' . $classLink . '"';
if ($block->getTarget()) {
$attributes[] = 'target="_blank" rel="noopener"';
}
$allAttributes = implode(' ', $attributes);
?>
<?php if ($content): ?>
<a
href="<?= $block->escapeUrl($content); ?>"
<?= $allAttributes; ?>
>
<?= $block->escapeHtml($title); ?>
</a>
<?php else: ?>
<span
<?= $allAttributes; ?>
tabindex="0"
>
<?= $block->escapeHtml($title); ?>
</span>
<?php endif; ?>

<a
<?php if ($content): ?>
href="<?= $block->escapeUrl($content) ?>"
<?php endif; ?>
<?= implode(' ', $attributes) ?>
>
<?= $title ?>
</a>
<?php if ($imageUrl): ?>
<img
src="<?= $block->escapeUrl($imageUrl); ?>"
Expand Down

0 comments on commit 13736e5

Please sign in to comment.