You are here

function uc_product_uninstall in Ubercart 8.4

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

Implements hook_uninstall().

File

uc_product/uc_product.install, line 181
Install, update and uninstall functions for the uc_product module.

Code

function uc_product_uninstall() {
  $styles = ImageStyle::loadMultiple([
    'uc_product',
    'uc_thumbnail',
  ]);
  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(),
    ]));
  }
}