
| Current Path : /var/www/html/rocksensor3/web/core/modules/system/src/Form/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor3/web/core/modules/system/src/Form/ClearCacheForm.php |
<?php
namespace Drupal\system\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Clear caches for this site.
*
* @internal
*/
class ClearCacheForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'system_clear_cache';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['clear_cache'] = [
'#type' => 'details',
'#title' => $this->t('Clear cache'),
'#open' => TRUE,
];
$form['clear_cache']['clear'] = [
'#type' => 'submit',
'#value' => $this->t('Clear all caches'),
];
return $form;
}
/**
* Clears the caches.
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
drupal_flush_all_caches();
$this->messenger()->addStatus($this->t('Caches cleared.'));
}
}