DeleteButton.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Search\Block\Adminhtml\Synonyms\Edit;
  7. use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
  8. /**
  9. * Class DeleteButton
  10. */
  11. class DeleteButton extends GenericButton implements ButtonProviderInterface
  12. {
  13. /**
  14. * @return array
  15. */
  16. public function getButtonData()
  17. {
  18. $data = [];
  19. if ($this->getGroupId()) {
  20. $data = [
  21. 'label' => __('Delete Synonym Group'),
  22. 'class' => 'delete',
  23. 'on_click' => 'deleteConfirm(\''
  24. . __('Are you sure you want to delete this synonym group?')
  25. . '\', \'' . $this->getDeleteUrl() . '\')',
  26. 'sort_order' => 20,
  27. ];
  28. }
  29. return $data;
  30. }
  31. /**
  32. * @return string
  33. */
  34. public function getDeleteUrl()
  35. {
  36. return $this->getUrl('*/*/delete', ['group_id' => $this->getGroupId()]);
  37. }
  38. }