<?php
/**
 * @category Mageants SimpleConfigurable
 * @package Mageants_SimpleConfigurable
 * @copyright Copyright (c) 2017 Mageants
 * @author Mageants Team <info@mageants.com>
 */

/**
 * Product view template
 *
 * @see \Magento\Catalog\Block\Product\View\Description
 */
?>
<?php
$helper = $block->getLayout()->createBlock(\Mageants\SimpleConfigurable\Block\Product\Renderer\Configurable::class);
$product = $block->getProduct();

if (!$product instanceof \Magento\Catalog\Model\Product) {
    return null;
}

$call = $block->getAtCall();
$code = $block->getAtCode();
$className = $block->getCssClass();
$attributeLabel = $block->getAtLabel();
$attributeType = $block->getAtType();
$attributeAddAttribute = $block->getAddAttribute();

$renderLabel = true;
// if defined as 'none' in layout, do not render
if ($attributeLabel == 'none') {
    $renderLabel = false;
}

if ($attributeLabel && $attributeLabel == 'default') {
    $attributeLabel = $product->getResource()->getAttribute($code)->getStoreLabel();
}
if ($attributeType && $attributeType == 'text') {
    $attributeValue = ($helper->outputHelper($product, $product->$call(), $code)) ? $product->
    getAttributeText($code) : '';
} else {
    $attributeValue = $helper->outputHelper($product, $product->$call(), $code);
}
?>
<div class="show_qty"></div>
<?php if ($attributeValue): ?>
<div class="product attribute <?= /* @noEscape */ $className ?>">
    <?php if ($renderLabel): ?><strong class="type"><?= /* @noEscape */ $attributeLabel ?></strong><?php endif; ?>
    <div class="value" <?= /* @noEscape */ $attributeAddAttribute ?>><?= /* @noEscape */ $attributeValue ?></div>
</div>
<?php endif; ?>
