Smile-SA/magento2-module-custom-entity

View on GitHub
view/frontend/templates/custom_entity/view.phtml

Summary

Maintainability
Test Coverage
<?php

/**
 * Attribute set frontend view block
 */

/**
 * @var $block \Smile\CustomEntity\Block\CustomEntity\View
 * @var $escaper Magento\Framework\Escaper
 */

$customEntity = $block->getEntity();

/** @var $outputViewModel Smile\CustomEntity\ViewModel\Output */
$outputViewModel = $block->getData('output_view_model');
?>
<?php if ($customEntity->getDescription()): ?>
  <div class="custom_entity attribute description">
      <div class="value">
          <?= /* @noEscape */
              $outputViewModel->customEntityAttribute(
                  $customEntity,
                  (string) $customEntity->getDescription(),
                  'description'
              ) ?>
      </div>
  </div>
<?php endif; ?>

<div class="actions">
    <a href="<?= $escaper->escapeUrl($block->getUrl($customEntity->getAttributeSetUrlKey())) ?>"
       title="<?= $escaper->escapeHtml(__('Back to %1', $customEntity->getAttributeSet()->getAttributeSetName())) ?>"
       class="action">
        <?= $escaper->escapeHtml(__('Back')) ?>
    </a>
</div>