<?php
use Magento\Catalog\Block\Product\View\Details;

/** @var Details $block */
$theme_settings = $this->helper( Olegnax\Athlete2\Helper\Helper::Class )->getConfig( 'athlete2_settings/product_quick_nav');
?>
<?php if ($detailedInfoGroup = $block->getGroupSortedChildNames('detailed_info', 'getChildHtml')): ?>
    <?php $layout = $block->getLayout(); ?>

    <?php foreach ($detailedInfoGroup as $name): ?>
        <?php
        $html = (string)$layout->renderElement($name);
        if (!$html || !trim($html)) {
            continue;
        }

        $alias = $layout->getElementAlias($name);
        if($theme_settings['hide_' . $alias ] ?? false){
            continue;
        }
        $label = ($theme_settings[$alias  . '_link_text'] ?? false) ?: $block->getChildData($alias, 'title');
        ?>
        <a class="a2-qn__link js-a2-qn__link js-tab-link" href="#<?= $block->escapeUrl($alias) ?>" data-target="#<?= $block->escapeUrl($alias) ?>">
            <span><?= /* @noEscape */ $label ?></span>
        </a>
    <?php endforeach; ?>

<?php endif; ?>