You are here

function google_tag_uninstall in GoogleTagManager 8

Same name and namespace in other branches
  1. 7.2 google_tag.install \google_tag_uninstall()
  2. 7 google_tag.install \google_tag_uninstall()

Implements hook_uninstall().

File

./google_tag.install, line 120
Provides install, update, and uninstall functions.

Code

function google_tag_uninstall() {
  if (\Drupal::config('google_tag.settings')
    ->get('flush_snippets')) {
    $directory = \Drupal::config('google_tag.settings')
      ->get('uri');
    if (!empty($directory)) {

      // Remove snippet file directory.
      \Drupal::service('file_system')
        ->deleteRecursive($directory . '/google_tag');
    }
  }

  // Reset the URL query argument so browsers reload snippet files.
  _drupal_flush_css_js();
}