You are here

function uc_catalog_uninstall in Ubercart 8.4

Same name and namespace in other branches
  1. 5 uc_catalog/uc_catalog.install \uc_catalog_uninstall()
  2. 6.2 uc_catalog/uc_catalog.install \uc_catalog_uninstall()
  3. 7.3 uc_catalog/uc_catalog.install \uc_catalog_uninstall()

Implements hook_uninstall().

File

uc_catalog/uc_catalog.install, line 25
Install, update and uninstall functions for the uc_catalog module.

Code

function uc_catalog_uninstall() {
  if ($vid = \Drupal::config('uc_catalog.settings')
    ->get('vocabulary')) {
    $vocab = Vocabulary::load($vid);
    \Drupal::messenger()
      ->addWarning(t('The Ubercart %catalog vocabulary has not been deleted. If you need to delete it, <a href=":url">please do so manually</a>.', [
      '%catalog' => $vocab
        ->label(),
      ':url' => Url::fromRoute('entity.taxonomy_vocabulary.edit_form', [
        'taxonomy_vocabulary' => $vocab
          ->id(),
      ])
        ->toString(),
    ]));
  }
  $styles = ImageStyle::loadMultiple([
    'uc_category',
    'uc_product_list',
  ]);
  if (!empty($styles)) {
    $style_names = [];
    foreach ($styles as $style) {
      $style_names[] = $style
        ->label();
    }
    \Drupal::messenger()
      ->addWarning(\Drupal::translation()
      ->formatPlural(count($style_names), 'The image style %style has not been deleted. If you need to delete it, <a href=":url">please do so manually</a>.', 'The image styles %styles have not been deleted. If you need to delete them, <a href=":url">please do so manually</a>.', [
      '%style' => $style_names[0],
      '%styles' => implode(', ', $style_names),
      ':url' => Url::fromRoute('entity.image_style.collection')
        ->toString(),
    ]));
  }
}