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

// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
?>
<?php if (($_products = $block->getProductCollection()) && $_products->getSize()) :?>
    <div class="block widget block-new-products-names">
        <div class="block-title">
            <strong><?= $block->escapeHtml(__('New Products')) ?></strong>
        </div>
        <div class="block-content">
            <?php $suffix = $block->getNameInLayout(); ?>
            <ol id="widget-new-products-<?= $block->escapeHtmlAttr($suffix) ?>"
                class="product-items product-items-names">
                <?php foreach ($_products->getItems() as $_product) :?>
                    <li class="product-item">
                        <strong class="product-item-name">
                            <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>"
                               title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>)"
                               class="product-item-link">
                                <?= /* @noEscape */ $this->helper(
                                    Magento\Catalog\Helper\Output::class
                                )->productAttribute($_product, $_product->getName(), 'name') ?>
                            </a>
                        </strong>
                    </li>
                <?php endforeach; ?>
            </ol>
            <?= $block->getPagerHtml() ?>
        </div>
    </div>
<?php endif; ?>
