SaveAndApplyButton.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\CatalogRule\Block\Adminhtml\Edit;
  7. use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
  8. class SaveAndApplyButton extends GenericButton implements ButtonProviderInterface
  9. {
  10. /**
  11. * @return array
  12. * @codeCoverageIgnore
  13. */
  14. public function getButtonData()
  15. {
  16. $data = [];
  17. if ($this->canRender('save_apply')) {
  18. $data = [
  19. 'label' => __('Save and Apply'),
  20. 'class' => 'save',
  21. 'on_click' => '',
  22. 'sort_order' => 80,
  23. 'data_attribute' => [
  24. 'mage-init' => [
  25. 'Magento_Ui/js/form/button-adapter' => [
  26. 'actions' => [
  27. [
  28. 'targetName' => 'catalog_rule_form.catalog_rule_form',
  29. 'actionName' => 'save',
  30. 'params' => [
  31. true,
  32. ['auto_apply' => 1],
  33. ]
  34. ]
  35. ]
  36. ]
  37. ],
  38. ]
  39. ];
  40. }
  41. return $data;
  42. }
  43. }