geolocation-8.x-3.x-dev/modules/geolocation_here/geolocation_here.install

modules/geolocation_here/geolocation_here.install
<?php

/**
 * @file
 * Handle requirements.
 */

use Drupal\Core\Url;

/**
 * {@inheritdoc}
 *
 * Implements hook_requirements().
 */
function geolocation_here_requirements(string $phase): array {
  $requirements = [];
  if ($phase == 'runtime') {
    $requirements['geolocation_here_api_key'] = [
      'title' => t('Geolocation - HERE Maps Key'),
      'value' => t('HERE Maps ID & Code set'),
      'description' => t('A HERE Maps key is set in the <a href=":geolocation_here_settings_url">Geolocation settings</a>.', [':geolocation_here_settings_url' => Url::fromRoute('geolocation_here.settings')->toString()]),
      'severity' => REQUIREMENT_OK,
    ];

    if (
      empty(\Drupal::config('here_maps.settings')->get('app_id'))
      || empty(\Drupal::config('here_maps.settings')->get('app_code'))
    ) {
      $requirements['geolocation_here_api_key']['value'] = t('HERE maps ID or code missing');
      $requirements['geolocation_here_api_key']['description'] = t('A HERE maps ID or code is missing in the <a href=":geolocation_here_settings_url">Geolocation settings</a>.', [':geolocation_here_settings_url' => Url::fromRoute('geolocation_here.settings')->toString()]);
      $requirements['geolocation_here_api_key']['severity'] = REQUIREMENT_WARNING;
    }
  }

  return $requirements;
}

/**
 * Implements hook_requirements().
 */
function geolocation_here_uninstall(): void {
  Drupal::configFactory()->getEditable('here_maps.settings')->delete();
}

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

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