depcalc-8.x-1.x-dev/modules/depcalc_ui/depcalc_ui.module

modules/depcalc_ui/depcalc_ui.module
<?php

/**
 * @file
 * Drupal Module: Dependency Calculation UI.
 *
 * Provides UI for Dependency Calculation.
 */

use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_form_FORM_ID_alter().
 */
function depcalc_ui_form_system_performance_settings_alter(&$form, FormStateInterface $form_state, $form_id) {
  $form['clear_cache']['clear_depcalc_cache'] = [
    '#type' => 'submit',
    '#value' => t('Clear depcalc cache'),
    '#name' => 'clear_depcalc_cache',
    '#submit' => ['depcalc_ui_submit_depcalc_cache_clear'],
    '#suffix' => t('Hint: Clear all caches, will not clear depcalc cache.'),
  ];
}

/**
 * Clears the depcalc cache.
 */
function depcalc_ui_submit_depcalc_cache_clear(array &$form, FormStateInterface $form_state) {
  /** @var \Drupal\depcalc\Cache\DepcalcCacheBackend $depcalc_cache */
  $depcalc_cache = \Drupal::service('cache.depcalc');
  $depcalc_cache->deleteAllPermanent();
  \Drupal::messenger()->addStatus(t('Cleared all depcalc cache.'));
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc