BackButton.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\AsynchronousOperations\Block\Adminhtml\Bulk\Details;
  7. use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
  8. use Magento\Framework\UrlInterface;
  9. /**
  10. * Back button configuration provider
  11. */
  12. class BackButton implements ButtonProviderInterface
  13. {
  14. /**
  15. * URL builder
  16. *
  17. * @var UrlInterface
  18. */
  19. private $urlBuilder;
  20. /**
  21. * @param UrlInterface $urlBuilder
  22. */
  23. public function __construct(
  24. UrlInterface $urlBuilder
  25. ) {
  26. $this->urlBuilder = $urlBuilder;
  27. }
  28. /**
  29. * Retrieve button data
  30. *
  31. * @return array button configuration
  32. */
  33. public function getButtonData()
  34. {
  35. return [
  36. 'label' => __('Back'),
  37. 'on_click' => sprintf("location.href = '%s';", $this->urlBuilder->getUrl('*/')),
  38. 'class' => 'back',
  39. 'sort_order' => 10
  40. ];
  41. }
  42. }