SaveButton.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Cms\Block\Adminhtml\Page\Edit;
  7. use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
  8. use Magento\Ui\Component\Control\Container;
  9. /**
  10. * Class SaveButton
  11. * @package Magento\Customer\Block\Adminhtml\Edit
  12. */
  13. class SaveButton extends GenericButton implements ButtonProviderInterface
  14. {
  15. /**
  16. * @return array
  17. */
  18. public function getButtonData()
  19. {
  20. return [
  21. 'label' => __('Save'),
  22. 'class' => 'save primary',
  23. 'data_attribute' => [
  24. 'mage-init' => [
  25. 'buttonAdapter' => [
  26. 'actions' => [
  27. [
  28. 'targetName' => 'cms_page_form.cms_page_form',
  29. 'actionName' => 'save',
  30. 'params' => [
  31. false
  32. ]
  33. ]
  34. ]
  35. ]
  36. ]
  37. ],
  38. 'class_name' => Container::SPLIT_BUTTON,
  39. 'options' => $this->getOptions(),
  40. 'sort_order' => 90,
  41. ];
  42. }
  43. /**
  44. * Retrieve options
  45. *
  46. * @return array
  47. */
  48. private function getOptions()
  49. {
  50. $options = [
  51. [
  52. 'label' => __('Save & Duplicate'),
  53. 'id_hard' => 'save_and_duplicate',
  54. 'data_attribute' => [
  55. 'mage-init' => [
  56. 'buttonAdapter' => [
  57. 'actions' => [
  58. [
  59. 'targetName' => 'cms_page_form.cms_page_form',
  60. 'actionName' => 'save',
  61. 'params' => [
  62. true,
  63. [
  64. 'back' => 'duplicate'
  65. ]
  66. ]
  67. ]
  68. ]
  69. ]
  70. ]
  71. ],
  72. ],
  73. [
  74. 'id_hard' => 'save_and_close',
  75. 'label' => __('Save & Close'),
  76. 'data_attribute' => [
  77. 'mage-init' => [
  78. 'buttonAdapter' => [
  79. 'actions' => [
  80. [
  81. 'targetName' => 'cms_page_form.cms_page_form',
  82. 'actionName' => 'save',
  83. 'params' => [
  84. true
  85. ]
  86. ]
  87. ]
  88. ]
  89. ]
  90. ],
  91. ]
  92. ];
  93. return $options;
  94. }
  95. }