File: /var/www/vhost/disk-apps/magento.bikenow.co/vendor/magento/module-wishlist/Block/Item/Configure.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Wishlist Item Configure block
* Serves for configuring item on product view page
*
* @module Wishlist
*/
namespace Magento\Wishlist\Block\Item;
/**
* @api
* @since 100.0.2
*/
class Configure extends \Magento\Framework\View\Element\Template
{
/**
* Wishlist data
*
* @var \Magento\Wishlist\Helper\Data
*/
protected $_wishlistData = null;
/**
* Core registry
*
* @var \Magento\Framework\Registry
*/
protected $_coreRegistry = null;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Wishlist\Helper\Data $wishlistData
* @param \Magento\Framework\Registry $registry
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Wishlist\Helper\Data $wishlistData,
\Magento\Framework\Registry $registry,
array $data = []
) {
$this->_wishlistData = $wishlistData;
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
}
/**
* Return wishlist widget options
*
* @return array
*/
public function getWishlistOptions()
{
return ['productType' => $this->escapeHtml($this->getProduct()->getTypeId())];
}
/**
* Returns product being edited
*
* @return \Magento\Catalog\Model\Product
*/
public function getProduct()
{
return $this->_coreRegistry->registry('product');
}
/**
* Get update params for http post
*
* @return bool|string
*/
public function getUpdateParams()
{
return $this->_wishlistData->getUpdateParams($this->getWishlistItem());
}
/**
* Returns wishlist item being configured
*
* @return \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item
*/
protected function getWishlistItem()
{
return $this->_coreRegistry->registry('wishlist_item');
}
/**
* Configure product view blocks
*
* @return $this
*/
protected function _prepareLayout()
{
// Set custom add to cart url
$block = $this->getLayout()->getBlock('product.info');
if ($block && $this->getWishlistItem()) {
$url = $this->_wishlistData->getAddToCartUrl($this->getWishlistItem());
$block->setCustomAddToCartUrl($url);
}
return parent::_prepareLayout();
}
}