<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 *  General template for displaying group of blocks divided into sections
 */

$group = $block->getGroupName();
$groupCss = $block->getGroupCss();
?>
<?php if ($detailedInfoGroup = $block->getGroupChildNames($group)):?>
    <div class="sections <?= $block->escapeHtmlAttr($groupCss) ?>">
        <?php $layout = $block->getLayout(); ?>
        <div class="section-items <?= $block->escapeHtmlAttr($groupCss) ?>-items"
             data-mage-init='{"tabs":{"openedState":"active"}}'>
            <?php foreach ($detailedInfoGroup as $name):?>
                <?php
                    $html = $layout->renderElement($name);
                if (!($html !== null && trim($html)) && ($block->getUseForce() != true)) {
                    continue;
                }
                    $alias = $layout->getElementAlias($name);
                    $label = $block->getChildData($alias, 'title');
                ?>
                <div class="section-item-title <?= $block->escapeHtmlAttr($groupCss) ?>-item-title"
                     data-role="collapsible">
                    <a class="<?= $block->escapeHtmlAttr($groupCss) ?>-item-switch"
                       data-toggle="switch" href="#<?= $block->escapeHtmlAttr($alias) ?>">
                        <?= /* @noEscape */ $label ?>
                    </a>
                </div>
                <div class="section-item-content <?= $block->escapeHtmlAttr($groupCss) ?>-item-content"
                     id="<?= $block->escapeHtmlAttr($alias) ?>"
                     data-role="content">
                    <?= /* @noEscape */ $html ?>
                </div>
            <?php endforeach;?>
        </div>
    </div>
<?php endif; ?>
