Edit.php 3.23 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Backend\Block\System\Cache;

/**
 * Cache management edit page
 *
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Edit extends \Magento\Backend\Block\Widget
{
    /**
     * @var string
     */
    protected $_template = 'Magento_Backend::system/cache/edit.phtml';

    /**
     * @return void
     */
    protected function _construct()
    {
        parent::_construct();

        $this->setTitle('Cache Management');
    }

    /**
     * {@inheritdoc}
     */
    protected function _prepareLayout()
    {
        $this->addChild(
            'save_button',
            \Magento\Backend\Block\Widget\Button::class,
            [
                'label' => __('Save Cache Settings'),
                'class' => 'save',
                'data_attribute' => [
                    'mage-init' => ['button' => ['event' => 'save', 'target' => '#config-edit-form']],
                ]
            ]
        );
        return parent::_prepareLayout();
    }

    /**
     * @return string
     */
    public function getSaveButtonHtml()
    {
        return $this->getChildHtml('save_button');
    }

    /**
     * @return string
     */
    public function getSaveUrl()
    {
        return $this->getUrl('adminhtml/*/save', ['_current' => true]);
    }

    /**
     * @return $this
     */
    public function initForm()
    {
        $this->setChild(
            'form',
            $this->getLayout()->createBlock(\Magento\Backend\Block\System\Cache\Form::class)->initForm()
        );
        return $this;
    }

    /**
     * Retrieve Catalog Tools Data
     *
     * @return array
     */
    public function getCatalogData()
    {
        return [
            'refresh_catalog_rewrites' => [
                'label' => __('Catalog Rewrites'),
                'buttons' => [['name' => 'refresh_catalog_rewrites', 'action' => __('Refresh')]],
            ],
            'clear_images_cache' => [
                'label' => __('Images Cache'),
                'buttons' => [['name' => 'clear_images_cache', 'action' => __('Clear')]],
            ],
            'rebuild_search_index' => [
                'label' => __('Search Index'),
                'buttons' => [['name' => 'rebuild_search_index', 'action' => __('Rebuild')]],
            ],
            'rebuild_inventory_stock_status' => [
                'label' => __('Inventory Stock Status'),
                'buttons' => [['name' => 'rebuild_inventory_stock_status', 'action' => __('Refresh')]],
            ],
            'rebuild_catalog_index' => [
                'label' => __('Rebuild Catalog Index'),
                'buttons' => [['name' => 'rebuild_catalog_index', 'action' => __('Rebuild')]],
            ],
            'rebuild_flat_catalog_category' => [
                'label' => __('Rebuild Flat Catalog Category'),
                'buttons' => [['name' => 'rebuild_flat_catalog_category', 'action' => __('Rebuild')]],
            ],
            'rebuild_flat_catalog_product' => [
                'label' => __('Rebuild Flat Catalog Product'),
                'buttons' => [['name' => 'rebuild_flat_catalog_product', 'action' => __('Rebuild')]],
            ]
        ];
    }
}