QuoteShortcutButtons.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Checkout\Block;
  7. use Magento\Framework\View\Element\Template;
  8. /**
  9. * Displays buttons on shopping cart page
  10. *
  11. * @api
  12. * @since 100.0.2
  13. */
  14. class QuoteShortcutButtons extends \Magento\Catalog\Block\ShortcutButtons
  15. {
  16. /**
  17. * @var \Magento\Checkout\Model\Session
  18. */
  19. protected $_checkoutSession;
  20. /**
  21. * @param Template\Context $context
  22. * @param \Magento\Checkout\Model\Session $checkoutSession
  23. * @param array $data
  24. * @codeCoverageIgnore
  25. */
  26. public function __construct(
  27. Template\Context $context,
  28. \Magento\Checkout\Model\Session $checkoutSession,
  29. array $data = []
  30. ) {
  31. parent::__construct($context, false, null, $data);
  32. $this->_checkoutSession = $checkoutSession;
  33. }
  34. /**
  35. * Dispatch shortcuts container event
  36. *
  37. * @return $this
  38. */
  39. protected function _beforeToHtml()
  40. {
  41. $this->_eventManager->dispatch(
  42. 'shortcut_buttons_container',
  43. [
  44. 'container' => $this,
  45. 'is_catalog_product' => $this->_isCatalogProduct,
  46. 'or_position' => $this->_orPosition,
  47. 'checkout_session' => $this->_checkoutSession,
  48. 'is_shopping_cart' => true
  49. ]
  50. );
  51. return $this;
  52. }
  53. }