mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 09:17:35 +00:00
70 lines
1.6 KiB
PHP
70 lines
1.6 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
namespace Magento\Checkout\Block;
|
|
|
|
/**
|
|
* "Checkout" link
|
|
*
|
|
* @SuppressWarnings(PHPMD.DepthOfInheritance)
|
|
*/
|
|
class Link extends \Magento\Framework\View\Element\Html\Link
|
|
{
|
|
/**
|
|
* @var \Magento\Framework\Module\Manager
|
|
*/
|
|
protected $_moduleManager;
|
|
|
|
/**
|
|
* @var \Magento\Checkout\Helper\Data
|
|
*/
|
|
protected $_checkoutHelper;
|
|
|
|
/**
|
|
* @param \Magento\Framework\View\Element\Template\Context $context
|
|
* @param \Magento\Framework\Module\Manager $moduleManager
|
|
* @param \Magento\Checkout\Helper\Data $checkoutHelper
|
|
* @param array $data
|
|
* @codeCoverageIgnore
|
|
*/
|
|
public function __construct(
|
|
\Magento\Framework\View\Element\Template\Context $context,
|
|
\Magento\Framework\Module\Manager $moduleManager,
|
|
\Magento\Checkout\Helper\Data $checkoutHelper,
|
|
array $data = []
|
|
) {
|
|
$this->_checkoutHelper = $checkoutHelper;
|
|
parent::__construct($context, $data);
|
|
$this->_moduleManager = $moduleManager;
|
|
}
|
|
|
|
/**
|
|
* Get href.
|
|
*
|
|
* @return string
|
|
* @codeCoverageIgnore
|
|
*/
|
|
public function getHref()
|
|
{
|
|
return $this->getUrl('checkout', ['_secure' => true]);
|
|
}
|
|
|
|
/**
|
|
* Render block HTML
|
|
*
|
|
* @return string
|
|
*/
|
|
protected function _toHtml()
|
|
{
|
|
if (!$this->_checkoutHelper->canOnepageCheckout() || !$this->_moduleManager->isOutputEnabled(
|
|
'Magento_Checkout'
|
|
)
|
|
) {
|
|
return '';
|
|
}
|
|
return parent::_toHtml();
|
|
}
|
|
}
|