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

/**
 * @var \Magento\Paypal\Block\Express\Shortcut $block
 */
?>
<?php
$labelPosition = '';
if ($block->isOrPositionBefore()) {
    $labelPosition = ' before';
} elseif ($block->isOrPositionAfter()) {
    $labelPosition = ' after';
}
$shortcutHtmlId = $block->escapeHtml($block->getShortcutHtmlId());
$isInCatalogProduct = false;
if ($block->getIsInCatalogProduct()) {
    $isInCatalogProduct = $block->getIsInCatalogProduct();
}
?>
<div data-label="<?= $block->escapeHtml(__('or')) ?>"
     class="paypal checkout <?= /* @noEscape */ $labelPosition ?> paypal-logo
        <?= /* @noEscape */ $shortcutHtmlId ?>"
     data-mage-init='{
     "paypalCheckout": {
                "isCatalogProduct": "<?= /* @noEscape */ !empty($isInCatalogProduct) ? (bool)$isInCatalogProduct : false ?>",
                "shortcutContainerClass": "<?= /* @noEscape */ "." . $shortcutHtmlId ?>"
            }
     }'
    >
    <input type="image" data-action="checkout-form-submit"
           data-checkout-url="<?= $block->escapeUrl($block->getCheckoutUrl()) ?>"
           src="<?= $block->escapeUrl($block->getImageUrl()) ?>"
           alt="<?= $block->escapeHtml(__('Checkout with PayPal')) ?>"
           title="<?= $block->escapeHtml(__('Checkout with PayPal')) ?>"/>
    <?php if ($block->getAdditionalLinkImage()) : ?>
        <?php $linkImage = $block->getAdditionalLinkImage(); ?>
        <a href="<?= $block->escapeUrl($linkImage['href']) ?>">
            <img src="<?= $block->escapeHtml($linkImage['src']) ?>" />
        </a>
    <?php endif; ?>
</div>
