You are here

function thunder_fia_uninstall in Thunder 8.3

Same name and namespace in other branches
  1. 8.2 modules/thunder_article/modules/thunder_fia/thunder_fia.install \thunder_fia_uninstall()

Implements hook_uninstall().

File

modules/thunder_article/modules/thunder_fia/thunder_fia.install, line 11
Thunder Facebook Instant Articles integration install hooks.

Code

function thunder_fia_uninstall() {

  /** @var \Drupal\Core\Config\ConfigFactoryInterface $configFactory */
  $configFactory = \Drupal::configFactory();
  $logger = \Drupal::logger('thunder_fia');
  $configNames = [
    'core.entity_view_display.media.gallery.facebook_instant_articles_rss',
    'core.entity_view_display.media.image.facebook_instant_articles_rss',
    'core.entity_view_display.media.video.facebook_instant_articles_rss',
    'core.entity_view_display.node.article.fb_instant_articles_rss',
    'core.entity_view_display.paragraph.gallery.facebook_instant_articles_rss',
    'core.entity_view_display.paragraph.image.facebook_instant_articles_rss',
    'core.entity_view_display.paragraph.video.facebook_instant_articles_rss',
    'core.entity_view_mode.media.facebook_instant_articles_rss',
    'core.entity_view_mode.paragraph.facebook_instant_articles_rss',
  ];
  foreach ($configNames as $configName) {
    try {
      $configFactory
        ->getEditable($configName)
        ->delete();
    } catch (\Exception $e) {
      $logger
        ->warning(sprintf('Unable to uninstall config: %s.', $configName));
    }
  }
}