Initialize.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace WeltPixel\Quickview\Block;
  3. /**
  4. * Quickview Initialize block
  5. */
  6. class Initialize extends \Magento\Framework\View\Element\Template
  7. {
  8. /**
  9. * @var \WeltPixel\QuickView\Helper\Data
  10. */
  11. protected $_helper;
  12. /**
  13. * @param \WeltPixel\Quickview\Helper\Data $helper
  14. * @param \Magento\Framework\View\Element\Template\Context $context
  15. * @param array $data
  16. */
  17. public function __construct(\WeltPixel\Quickview\Helper\Data $helper,
  18. \Magento\Framework\View\Element\Template\Context $context,
  19. array $data = [])
  20. {
  21. $this->_helper = $helper;
  22. parent::__construct($context, $data);
  23. }
  24. /**
  25. * Returns config
  26. *
  27. * @return array
  28. */
  29. public function getConfig()
  30. {
  31. return [
  32. 'baseUrl' => $this->getBaseUrl(),
  33. 'closeSeconds' => $this->_helper->getCloseSeconds(),
  34. 'showMiniCart' => $this->_helper->getScrollAndOpenMiniCart(),
  35. 'showShoppingCheckoutButtons' => $this->_helper->getShoppingCheckoutButtons()
  36. ];
  37. }
  38. /**
  39. * Return base url.
  40. *
  41. * @codeCoverageIgnore
  42. * @return string
  43. */
  44. public function getBaseUrl()
  45. {
  46. return $this->_storeManager->getStore()->getBaseUrl();
  47. }
  48. }