You are here

function fontawesome_uninstall in Font Awesome Icons 8

Same name and namespace in other branches
  1. 8.2 fontawesome.install \fontawesome_uninstall()
  2. 7.3 fontawesome.install \fontawesome_uninstall()
  3. 7.2 fontawesome.install \fontawesome_uninstall()

Implements hook_uninstall().

File

./fontawesome.install, line 49
Requirements page for Font Awesome.

Code

function fontawesome_uninstall() {

  // Delete set variables.
  $query = \Drupal::database()
    ->delete('config');
  $query
    ->condition('name', 'fontawesome.settings');
  $query
    ->execute();
  $query = \Drupal::database()
    ->delete('key_value');
  $query
    ->condition('name', 'fontawesome');
  $query
    ->execute();

  // Icon API module : Delete fontawesome icon bundle & clear cache.
  if (\Drupal::moduleHandler()
    ->moduleExists('icon') && ($cache = \Drupal::cache()
    ->get('icon_bundles')) && !empty($cache->data)) {
    $fa_icon_bundle = isset($cache->data['fontawesome']) ? $cache->data['fontawesome'] : [];
    $fa_icon_bundle['path'] = isset($fa_icon_bundle['path']) ? $fa_icon_bundle['path'] : 'fontawesome';
    icon_bundle_delete($fa_icon_bundle);
  }
}