You are here

public function ToolbarController::flushLibraries in Helper 8

Flush the libraries (and CSS/JS) cache.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Reloads the page.

1 string reference to 'ToolbarController::flushLibraries'
helper.routing.yml in ./helper.routing.yml
helper.routing.yml

File

src/Controller/ToolbarController.php, line 86

Class

ToolbarController
Toolbar controller.

Namespace

Drupal\helper\Controller

Code

public function flushLibraries() {
  Cache::invalidateTags([
    'library_info',
  ]);
  \Drupal::service('asset.css.collection_optimizer')
    ->deleteAll();
  \Drupal::service('asset.js.collection_optimizer')
    ->deleteAll();
  _drupal_flush_css_js();
  $this
    ->messenger()
    ->addMessage($this
    ->t('Libraries cache cleared.'));
  return new RedirectResponse($this
    ->reloadPage());
}