BlockProductViewGallery.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace WeltPixel\Quickview\Plugin;
  3. class BlockProductViewGallery
  4. {
  5. /**
  6. * @var \Magento\Framework\App\Config\ScopeConfigInterface
  7. */
  8. protected $scopeConfig;
  9. /**
  10. * @var \Magento\Framework\App\Request\Http
  11. */
  12. protected $request;
  13. /**
  14. * ResultPage constructor.
  15. * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  16. * @param \Magento\Framework\App\Request\Http $request
  17. */
  18. public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
  19. \Magento\Framework\App\Request\Http $request)
  20. {
  21. $this->request = $request;
  22. $this->scopeConfig = $scopeConfig;
  23. }
  24. /**
  25. * @param \Magento\Catalog\Block\Product\View\Gallery $subject
  26. * @param \Closure $proceed
  27. * @param string $name
  28. * @param string|null $module
  29. * @return string|false
  30. */
  31. public function aroundGetVar(
  32. \Magento\Catalog\Block\Product\View\Gallery $subject,
  33. \Closure $proceed,
  34. $name,
  35. $module = null
  36. )
  37. {
  38. $result = $proceed($name, $module);
  39. if ($this->request->getFullActionName() != 'weltpixel_quickview_catalog_product_view') {
  40. return $result;
  41. }
  42. switch ($name) {
  43. case "gallery/navdir" :
  44. $removeProductImageThumb = $this->scopeConfig->getValue(\WeltPixel\Quickview\Observer\AddUpdateHandlesObserver::XML_PATH_QUICKVIEW_REMOVE_PRODUCT_IMAGE_THUMB, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
  45. if ($removeProductImageThumb) {
  46. $result = 'horizontal';
  47. }
  48. break;
  49. /* Disable the image fullscreen on quickview*/
  50. case "gallery/allowfullscreen" :
  51. $result = 'false';
  52. break;
  53. }
  54. return $result;
  55. }
  56. }