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

// @codingStandardsIgnoreFile

?>
<?php

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

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