Edit.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Backend\Block\System\Cache;
  7. /**
  8. * Cache management edit page
  9. *
  10. * @author Magento Core Team <core@magentocommerce.com>
  11. */
  12. class Edit extends \Magento\Backend\Block\Widget
  13. {
  14. /**
  15. * @var string
  16. */
  17. protected $_template = 'Magento_Backend::system/cache/edit.phtml';
  18. /**
  19. * @return void
  20. */
  21. protected function _construct()
  22. {
  23. parent::_construct();
  24. $this->setTitle('Cache Management');
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. protected function _prepareLayout()
  30. {
  31. $this->addChild(
  32. 'save_button',
  33. \Magento\Backend\Block\Widget\Button::class,
  34. [
  35. 'label' => __('Save Cache Settings'),
  36. 'class' => 'save',
  37. 'data_attribute' => [
  38. 'mage-init' => ['button' => ['event' => 'save', 'target' => '#config-edit-form']],
  39. ]
  40. ]
  41. );
  42. return parent::_prepareLayout();
  43. }
  44. /**
  45. * @return string
  46. */
  47. public function getSaveButtonHtml()
  48. {
  49. return $this->getChildHtml('save_button');
  50. }
  51. /**
  52. * @return string
  53. */
  54. public function getSaveUrl()
  55. {
  56. return $this->getUrl('adminhtml/*/save', ['_current' => true]);
  57. }
  58. /**
  59. * @return $this
  60. */
  61. public function initForm()
  62. {
  63. $this->setChild(
  64. 'form',
  65. $this->getLayout()->createBlock(\Magento\Backend\Block\System\Cache\Form::class)->initForm()
  66. );
  67. return $this;
  68. }
  69. /**
  70. * Retrieve Catalog Tools Data
  71. *
  72. * @return array
  73. */
  74. public function getCatalogData()
  75. {
  76. return [
  77. 'refresh_catalog_rewrites' => [
  78. 'label' => __('Catalog Rewrites'),
  79. 'buttons' => [['name' => 'refresh_catalog_rewrites', 'action' => __('Refresh')]],
  80. ],
  81. 'clear_images_cache' => [
  82. 'label' => __('Images Cache'),
  83. 'buttons' => [['name' => 'clear_images_cache', 'action' => __('Clear')]],
  84. ],
  85. 'rebuild_search_index' => [
  86. 'label' => __('Search Index'),
  87. 'buttons' => [['name' => 'rebuild_search_index', 'action' => __('Rebuild')]],
  88. ],
  89. 'rebuild_inventory_stock_status' => [
  90. 'label' => __('Inventory Stock Status'),
  91. 'buttons' => [['name' => 'rebuild_inventory_stock_status', 'action' => __('Refresh')]],
  92. ],
  93. 'rebuild_catalog_index' => [
  94. 'label' => __('Rebuild Catalog Index'),
  95. 'buttons' => [['name' => 'rebuild_catalog_index', 'action' => __('Rebuild')]],
  96. ],
  97. 'rebuild_flat_catalog_category' => [
  98. 'label' => __('Rebuild Flat Catalog Category'),
  99. 'buttons' => [['name' => 'rebuild_flat_catalog_category', 'action' => __('Rebuild')]],
  100. ],
  101. 'rebuild_flat_catalog_product' => [
  102. 'label' => __('Rebuild Flat Catalog Product'),
  103. 'buttons' => [['name' => 'rebuild_flat_catalog_product', 'action' => __('Rebuild')]],
  104. ]
  105. ];
  106. }
  107. }