country_path-8.x-1.4/country_path.install

country_path.install
<?php

/**
 * @file
 * Install file for Country path module.
 */

/**
 * Implements hook_uninstall().
 *
 * On uninstall disable 'country-path-language-url' LanguageNegotiation Plugin.
 */
function country_path_uninstall() {
  if (!\Drupal::moduleHandler()->moduleExists('language')) {
    return;
  }
  $new_configuration = [];
  $types = [
    'language_url',
    'language_interface',
    'language_content',
  ];
  $negotiator = \Drupal::service('language_negotiator');
  foreach ($types as $type) {
    $language_plugins_enabled = \Drupal::config('language.types')->get(
      'negotiation.' . $type . '.enabled'
    );
    foreach ($language_plugins_enabled as $plugin => $weight) {
      if ($plugin != 'country-path-language-url') {
        $new_configuration[$type][$plugin] = $weight;
      }
    }
    $negotiator->saveConfiguration($type, $new_configuration[$type]);
  }
}

/**
 * Implements hook_install().
 */
function country_path_install(): void {
  if (\Drupal::moduleHandler()->moduleExists('language')) {
    country_path_activate_plugin_for_language_url_negotiator();
  }
}

/**
 * Activate country-path-language-url plugin for the language_url negotiation.
 */
function country_path_update_8001(): void {
  if (\Drupal::moduleHandler()->moduleExists('language')) {
    country_path_activate_plugin_for_language_url_negotiator();
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc