![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-wishlist/Controller/Shared/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Wishlist\Controller\Shared; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\Controller\ResultFactory; class Index extends Action { /** * Core registry * * @var \Magento\Framework\Registry */ protected $registry = null; /** * @var WishlistProvider */ protected $wishlistProvider; /** * @var \Magento\Customer\Model\Session */ protected $customerSession; /** * @param Context $context * @param WishlistProvider $wishlistProvider * @param \Magento\Framework\Registry $registry * @param \Magento\Customer\Model\Session $customerSession */ public function __construct( Context $context, WishlistProvider $wishlistProvider, \Magento\Framework\Registry $registry, \Magento\Customer\Model\Session $customerSession ) { $this->wishlistProvider = $wishlistProvider; $this->registry = $registry; $this->customerSession = $customerSession; parent::__construct($context); } /** * Shared wishlist view page * * @return \Magento\Framework\Controller\ResultInterface */ public function execute() { $wishlist = $this->wishlistProvider->getWishlist(); $customerId = $this->customerSession->getCustomerId(); if ($wishlist && $wishlist->getCustomerId() && $wishlist->getCustomerId() == $customerId) { /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); $resultRedirect->setUrl( $this->_objectManager->get(\Magento\Wishlist\Helper\Data::class)->getListUrl($wishlist->getId()) ); return $resultRedirect; } $this->registry->register('shared_wishlist', $wishlist); /** @var \Magento\Framework\View\Result\Page $resultPage */ $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE); return $resultPage; } }