352 lines
21 KiB
PHTML
352 lines
21 KiB
PHTML
<?php
|
|
/** @var \Esun\Wiki\Block\Wiki\View $block */
|
|
$currentCategory = $block->getCurrentCategory();
|
|
$isHomepage = $block->isHomepage();
|
|
$searchQuery = $block->getSearchQuery();
|
|
$anchors = $block->getAnchors();
|
|
$tooltips = $block->getTooltips();
|
|
$previousCategory = $block->getPreviousCategory();
|
|
$nextCategory = $block->getNextCategory();
|
|
$renderTree = function (array $nodes, int $level = 0) use (&$renderTree, $block): void {
|
|
if (!$nodes) {
|
|
return;
|
|
}
|
|
?>
|
|
<ul class="esun-wiki-tree esun-wiki-tree-level-<?= (int) $level ?>">
|
|
<?php foreach ($nodes as $node): ?>
|
|
<?php
|
|
$category = $node['category'];
|
|
$children = $node['children'];
|
|
$hasChildren = !empty($children);
|
|
$isCurrent = $block->isCurrent($category);
|
|
$isClickable = $block->isCategoryClickable($category);
|
|
$isOpen = $hasChildren && (
|
|
$isCurrent
|
|
|| $block->isInCurrentPath($category)
|
|
|| $block->isCategoryOpenByDefault($category)
|
|
);
|
|
$logoUrl = $block->getCategoryLogoUrl($category);
|
|
?>
|
|
<li class="esun-wiki-tree-item <?= $isCurrent ? 'is-active' : '' ?> <?= $isOpen ? 'is-open' : '' ?> <?= !$isClickable ? 'is-not-clickable' : '' ?>">
|
|
<div class="esun-wiki-tree-row">
|
|
<?php if ($isClickable): ?>
|
|
<a class="esun-wiki-tree-link"
|
|
href="<?= $block->escapeUrl($block->getCategoryUrl($category)) ?>">
|
|
<?php else: ?>
|
|
<span class="esun-wiki-tree-link is-disabled" aria-disabled="true">
|
|
<?php endif; ?>
|
|
<?php if ($logoUrl !== ''): ?>
|
|
<img class="esun-wiki-tree-logo"
|
|
src="<?= $block->escapeUrl($logoUrl) ?>"
|
|
alt=""
|
|
loading="lazy">
|
|
<?php endif; ?>
|
|
<span class="esun-wiki-tree-title">
|
|
<?= $block->escapeHtml((string) $category->getData('title')) ?>
|
|
</span>
|
|
<?php if ($isClickable): ?>
|
|
</a>
|
|
<?php else: ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
<?php if ($hasChildren): ?>
|
|
<button class="esun-wiki-tree-toggle"
|
|
type="button"
|
|
aria-label="<?= $block->escapeHtmlAttr(__('Toggle category')) ?>"
|
|
aria-expanded="<?= $isOpen ? 'true' : 'false' ?>">
|
|
<span aria-hidden="true"></span>
|
|
</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php if ($hasChildren): ?>
|
|
<div class="esun-wiki-tree-children">
|
|
<?php $renderTree($children, $level + 1); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<?php
|
|
};
|
|
?>
|
|
<div class="esun-wiki-page" data-mage-init='{"Esun_Wiki/js/wiki": {}}'>
|
|
<section class="esun-wiki-hero"
|
|
style="background-image:linear-gradient(90deg, rgba(14, 18, 22, .42), rgba(14, 18, 22, .12)), url('<?= $block->escapeUrl($block->getHeroBackgroundUrl()) ?>')">
|
|
<div class="esun-wiki-title"><?= $block->escapeHtml(__('eSUN Wiki')) ?></div>
|
|
<form class="esun-wiki-search" method="get" action="<?= $block->escapeUrl($block->getSearchUrl()) ?>">
|
|
<input type="search"
|
|
name="q"
|
|
value="<?= $block->escapeHtmlAttr($searchQuery) ?>"
|
|
placeholder="<?= $block->escapeHtmlAttr(__('Search......')) ?>"
|
|
aria-label="<?= $block->escapeHtmlAttr(__('Search wiki')) ?>">
|
|
<button class="esun-wiki-search-clear <?= $searchQuery !== '' ? 'is-visible' : '' ?>" type="button"
|
|
aria-label="<?= $block->escapeHtmlAttr(__('Clear search')) ?>"></button>
|
|
<button class="esun-wiki-search-submit" type="submit"
|
|
aria-label="<?= $block->escapeHtmlAttr(__('Search')) ?>">
|
|
<svg t="1785230095468" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="39389" width="30" height="30"><path d="M727.893457 795.690762a446.634481 446.634481 0 0 1-280.575883 98.901292C200.277677 894.592054 0.000427 694.314804 0.000427 447.317574a446.293147 446.293147 0 0 1 154.453269-338.133193A445.653148 445.653148 0 0 1 447.317574 0.000427c247.039897 0 447.27448 200.27725 447.27448 447.317147a446.165147 446.165147 0 0 1-98.901292 280.618549l212.650578 212.650578a47.914647 47.914647 0 1 1-67.754639 67.797306z m-280.575883 3.071999a351.573187 351.573187 0 0 0 333.397194-239.9999 351.445187 351.445187 0 0 0-333.397194-462.933141 349.866521 349.866521 0 0 0-230.058571 85.759964 351.445187 351.445187 0 0 0 230.058571 617.13041z m0-607.061081a47.914647 47.914647 0 1 1 0 95.829294 159.743933 159.743933 0 0 0-159.7866 159.7866 47.914647 47.914647 0 0 1-95.829294 0 255.573227 255.573227 0 0 1 255.573227-255.615894z" fill="#17a957" p-id="39390"></path></svg>
|
|
</button>
|
|
</form>
|
|
</section>
|
|
|
|
<div class="esun-wiki-drawer-backdrop"
|
|
data-wiki-drawer-close
|
|
aria-hidden="true"></div>
|
|
|
|
<div class="esun-wiki-shell <?= $anchors ? 'has-toc' : 'has-no-toc' ?>">
|
|
<div class="esun-wiki-mobile-actions" aria-label="<?= $block->escapeHtmlAttr(__('Wiki navigation')) ?>">
|
|
<button class="esun-wiki-mobile-trigger"
|
|
type="button"
|
|
data-wiki-drawer-open="categories"
|
|
aria-controls="esun-wiki-category-drawer"
|
|
aria-expanded="false"
|
|
aria-label="<?= $block->escapeHtmlAttr(__('Open wiki categories')) ?>"
|
|
title="<?= $block->escapeHtmlAttr(__('Wiki categories')) ?>">
|
|
<span class="esun-wiki-mobile-trigger-icon esun-wiki-mobile-trigger-icon--menu"
|
|
aria-hidden="true"></span>
|
|
</button>
|
|
<?= $block->escapeHtmlAttr(__('Wiki Menu')) ?>
|
|
</div>
|
|
|
|
<aside class="esun-wiki-sidebar esun-wiki-drawer esun-wiki-drawer--left"
|
|
id="esun-wiki-category-drawer"
|
|
data-wiki-drawer="categories"
|
|
aria-label="<?= $block->escapeHtmlAttr(__('Wiki categories')) ?>">
|
|
<div class="esun-wiki-drawer-header">
|
|
<strong><?= $block->escapeHtml(__('Wiki categories')) ?></strong>
|
|
<button class="esun-wiki-drawer-close"
|
|
type="button"
|
|
data-wiki-drawer-close
|
|
aria-label="<?= $block->escapeHtmlAttr(__('Close wiki categories')) ?>">
|
|
<span aria-hidden="true"></span>
|
|
</button>
|
|
</div>
|
|
<nav>
|
|
<?php $renderTree($block->getCategoryTree()); ?>
|
|
</nav>
|
|
</aside>
|
|
|
|
<main class="esun-wiki-main" id="wiki-top">
|
|
<?php if ($currentCategory && !$isHomepage): ?>
|
|
<div class="esun-wiki-breadcrumbs">
|
|
<a href="<?= $block->escapeUrl($block->getWikiHomeUrl()) ?>">
|
|
<?= $block->escapeHtml(__('esun wiki')) ?>
|
|
</a>
|
|
<?php foreach ($block->getBreadcrumbItems() as $breadcrumb): ?>
|
|
<span aria-hidden="true">/</span>
|
|
<?php if ($block->isCategoryClickable($breadcrumb)): ?>
|
|
<a href="<?= $block->escapeUrl($block->getCategoryUrl($breadcrumb)) ?>">
|
|
<?= $block->escapeHtml((string) $breadcrumb->getData('title')) ?>
|
|
</a>
|
|
<?php else: ?>
|
|
<span><?= $block->escapeHtml((string) $breadcrumb->getData('title')) ?></span>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($block->hasSearchQuery()): ?>
|
|
<section class="esun-wiki-search-results">
|
|
<h2><?= $block->escapeHtml(__('Search results for "%1"', $searchQuery)) ?></h2>
|
|
<?php $results = $block->getSearchResults(); ?>
|
|
<?php if (!$results): ?>
|
|
<p class="esun-wiki-empty">
|
|
<?= $block->escapeHtml(__('No wiki content matched your search.')) ?>
|
|
</p>
|
|
<?php endif; ?>
|
|
<?php foreach ($results as $result): ?>
|
|
<article class="esun-wiki-result">
|
|
<a href="<?= $block->escapeUrl($block->getCategoryUrl($result)) ?>">
|
|
<?= $block->escapeHtml((string) $result->getData('title')) ?>
|
|
</a>
|
|
<p><?= $block->escapeHtml($block->getSearchSnippet($result)) ?></p>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</section>
|
|
<?php elseif ($currentCategory): ?>
|
|
<article class="esun-wiki-article">
|
|
<h1<?= $isHomepage ? ' class="wiki-homepage-title"' : '' ?>>
|
|
<?= $block->escapeHtml((string) $currentCategory->getData('title')) ?>
|
|
</h1>
|
|
<div class="esun-wiki-content">
|
|
<?= /* @noEscape */ $block->getProcessedContent() ?>
|
|
</div>
|
|
<?php if (!$isHomepage): ?>
|
|
<?= /* @noEscape */ $block->getChildHtml('parameter_comparison') ?>
|
|
<?= /* @noEscape */ $block->getChildHtml('download_center') ?>
|
|
<?php endif; ?>
|
|
</article>
|
|
<?php if ($previousCategory || $nextCategory): ?>
|
|
<nav class="esun-wiki-bottom-nav" aria-label="<?= $block->escapeHtmlAttr(__('Wiki previous and next')) ?>">
|
|
<?php if ($previousCategory): ?>
|
|
<a class="esun-wiki-bottom-link esun-wiki-bottom-link-previous"
|
|
href="<?= $block->escapeUrl($block->getCategoryUrl($previousCategory)) ?>">
|
|
<span class="esun-wiki-bottom-arrow" aria-hidden="true"></span>
|
|
<span class="esun-wiki-bottom-text">
|
|
<strong><?= $block->escapeHtml(__('Previous')) ?></strong>
|
|
<span><?= $block->escapeHtml((string) $previousCategory->getData('title')) ?></span>
|
|
</span>
|
|
</a>
|
|
<?php else: ?>
|
|
<span class="esun-wiki-bottom-link esun-wiki-bottom-link-previous is-disabled"></span>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($nextCategory): ?>
|
|
<a class="esun-wiki-bottom-link esun-wiki-bottom-link-next"
|
|
href="<?= $block->escapeUrl($block->getCategoryUrl($nextCategory)) ?>">
|
|
<span class="esun-wiki-bottom-text">
|
|
<strong><?= $block->escapeHtml(__('Next')) ?></strong>
|
|
<span><?= $block->escapeHtml((string) $nextCategory->getData('title')) ?></span>
|
|
</span>
|
|
<span class="esun-wiki-bottom-arrow esun-wiki-bottom-arrow-next" aria-hidden="true"></span>
|
|
</a>
|
|
<?php else: ?>
|
|
<span class="esun-wiki-bottom-link esun-wiki-bottom-link-next is-disabled"></span>
|
|
<?php endif; ?>
|
|
</nav>
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
<div class="esun-wiki-empty">
|
|
<?= $block->escapeHtml(__('No wiki categories are available yet. Add content from the Magento admin.')) ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</main>
|
|
|
|
<?php if ($anchors): ?>
|
|
<aside class="esun-wiki-toc esun-wiki-drawer esun-wiki-drawer--right"
|
|
id="esun-wiki-anchor-drawer"
|
|
data-wiki-drawer="anchors"
|
|
aria-label="<?= $block->escapeHtmlAttr(__('Wiki content anchors')) ?>">
|
|
<div class="esun-wiki-drawer-header">
|
|
<strong><?= $block->escapeHtml(__('On this page')) ?></strong>
|
|
<button class="esun-wiki-drawer-close"
|
|
type="button"
|
|
data-wiki-drawer-close
|
|
aria-label="<?= $block->escapeHtmlAttr(__('Close content anchors')) ?>">
|
|
<span aria-hidden="true"></span>
|
|
</button>
|
|
</div>
|
|
<div class="esun-wiki-toc-card">
|
|
<ul>
|
|
<?php foreach ($anchors as $anchor): ?>
|
|
<li class="level-<?= (int) $anchor['level'] ?>">
|
|
<a href="#<?= $block->escapeHtmlAttr($anchor['id']) ?>">
|
|
<?= $block->escapeHtml($anchor['label']) ?>
|
|
</a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</div>
|
|
</aside>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
<?php if ($tooltips): ?>
|
|
<div class="esun-wiki-tooltip-layer" aria-live="polite">
|
|
<?php foreach ($tooltips as $tooltip): ?>
|
|
<div class="esun-wiki-tooltip esun-wiki-tooltip--<?= $block->escapeHtmlAttr($tooltip['type']) ?>"
|
|
id="<?= $block->escapeHtmlAttr($tooltip['id']) ?>"
|
|
data-wiki-tooltip-id="<?= $block->escapeHtmlAttr($tooltip['id']) ?>"
|
|
role="dialog"
|
|
aria-label="<?= $block->escapeHtmlAttr(
|
|
$tooltip['type'] === 'product' ? $tooltip['name'] : $tooltip['title']
|
|
) ?>"
|
|
aria-modal="false"
|
|
aria-hidden="true">
|
|
<?php if ($tooltip['type'] === 'product'): ?>
|
|
<div class="esun-wiki-product-tip__visual">
|
|
<a href="<?= $block->escapeUrl($tooltip['product_url']) ?>"
|
|
aria-label="<?= $block->escapeHtmlAttr($tooltip['name']) ?>">
|
|
<?php if ($tooltip['image_url'] !== ''): ?>
|
|
<img src="<?= $block->escapeUrl($tooltip['image_url']) ?>"
|
|
alt="<?= $block->escapeHtmlAttr($tooltip['name']) ?>"
|
|
loading="lazy">
|
|
<?php endif; ?>
|
|
</a>
|
|
<div class="esun-wiki-product-tip__price">
|
|
<strong><?= $block->escapeHtml($tooltip['final_price']) ?></strong>
|
|
<?php if ($tooltip['regular_price'] !== ''): ?>
|
|
<del><?= $block->escapeHtml($tooltip['regular_price']) ?></del>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="esun-wiki-product-tip__action">
|
|
<?php if ($tooltip['can_add_to_cart']): ?>
|
|
<form data-role="tocart-form"
|
|
data-product-sku="<?= $block->escapeHtmlAttr($tooltip['sku']) ?>"
|
|
action="<?= $block->escapeUrl($tooltip['add_to_cart']['action']) ?>"
|
|
data-mage-init='{"catalogAddToCart": {}}'
|
|
method="post">
|
|
<input type="hidden" name="product"
|
|
value="<?= (int) $tooltip['add_to_cart']['product'] ?>">
|
|
<input type="hidden" name="uenc"
|
|
value="<?= $block->escapeHtmlAttr($tooltip['add_to_cart']['uenc']) ?>">
|
|
<?= $block->getBlockHtml('formkey') ?>
|
|
<button class="esun-wiki-product-tip__cart" type="submit"
|
|
title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>">
|
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
<path d="M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.7a2 2 0 0 0 2-1.6L20 8H7M10 20a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm8 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"/>
|
|
</svg>
|
|
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
|
|
</button>
|
|
</form>
|
|
<?php elseif ($tooltip['is_saleable']): ?>
|
|
<a class="esun-wiki-product-tip__cart"
|
|
href="<?= $block->escapeUrl($tooltip['product_url']) ?>"
|
|
title="<?= $block->escapeHtmlAttr(__('Choose Options')) ?>">
|
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
<path d="M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.7a2 2 0 0 0 2-1.6L20 8H7M10 20a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm8 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"/>
|
|
</svg>
|
|
<span><?= $block->escapeHtml(__('Choose Options')) ?></span>
|
|
</a>
|
|
<?php else: ?>
|
|
<button class="esun-wiki-product-tip__cart is-disabled" type="button" disabled
|
|
title="<?= $block->escapeHtmlAttr(__('Out of stock')) ?>">
|
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
<path d="M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.7a2 2 0 0 0 2-1.6L20 8H7M10 20a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm8 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"/>
|
|
</svg>
|
|
<span><?= $block->escapeHtml(__('Out of stock')) ?></span>
|
|
</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<a class="esun-wiki-product-tip__name"
|
|
href="<?= $block->escapeUrl($tooltip['product_url']) ?>">
|
|
<?= $block->escapeHtml($tooltip['name']) ?>
|
|
</a>
|
|
<?php else: ?>
|
|
<?php if ($tooltip['image_url'] !== ''): ?>
|
|
<div class="esun-wiki-term-tip__image">
|
|
<img src="<?= $block->escapeUrl($tooltip['image_url']) ?>"
|
|
alt="<?= $block->escapeHtmlAttr($tooltip['image_alt']) ?>">
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if ($tooltip['link_label'] !== ''): ?>
|
|
<?php if ($tooltip['link_url'] !== ''): ?>
|
|
<a class="esun-wiki-term-tip__link"
|
|
href="<?= $block->escapeUrl($tooltip['link_url']) ?>">
|
|
<?= $block->escapeHtml($tooltip['link_label']) ?>
|
|
</a>
|
|
<?php else: ?>
|
|
<span class="esun-wiki-term-tip__link">
|
|
<?= $block->escapeHtml($tooltip['link_label']) ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
<?php if ($tooltip['title'] !== ''): ?>
|
|
<strong class="esun-wiki-term-tip__title">
|
|
<?= $block->escapeHtml($tooltip['title']) ?>
|
|
</strong>
|
|
<?php endif; ?>
|
|
<?php if ($tooltip['description'] !== ''): ?>
|
|
<p class="esun-wiki-term-tip__description">
|
|
<?= $block->escapeHtml($tooltip['description']) ?>
|
|
</p>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|