BackButton.php 911 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Copyright © 2016 Ihor Vansach (ihor@magefan.com). All rights reserved.
  4. * See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
  5. *
  6. * Glory to Ukraine! Glory to the heroes!
  7. */
  8. namespace Magefan\Blog\Block\Adminhtml\Edit;
  9. use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
  10. /**
  11. * Class BackButton
  12. */
  13. class BackButton extends GenericButton implements ButtonProviderInterface
  14. {
  15. /**
  16. * @return array
  17. */
  18. public function getButtonData()
  19. {
  20. return [
  21. 'label' => __('Back'),
  22. 'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()),
  23. 'class' => 'back',
  24. 'sort_order' => 10
  25. ];
  26. }
  27. /**
  28. * Get URL for back (reset) button
  29. *
  30. * @return string
  31. */
  32. public function getBackUrl()
  33. {
  34. return $this->getUrl('*/*/');
  35. }
  36. }