drowl_paragraphs_bs-1.x-dev/modules/drowl_paragraphs_bs_type_countdown/drowl_paragraphs_bs_type_countdown.install

modules/drowl_paragraphs_bs_type_countdown/drowl_paragraphs_bs_type_countdown.install
<?php

/**
 * @file
 * Install, update and uninstall functions for drowl_paragraphs_bs_type_countdown.
 */

/**
 * Implements hook_requirements().
 */
function drowl_paragraphs_bs_type_countdown_requirements($phase) {
  $requirements = [];
  if ($phase == 'runtime') {
    $library_definition = \Drupal::service('library.discovery')->getLibraryByName('drowl_paragraphs_bs_type_countdown', 'global');
    $library = [];
    if (!file_exists(DRUPAL_ROOT . '/' . $library_definition['js'][0]['data']) || !file_exists(DRUPAL_ROOT . '/' . $library_definition['css'][0]['data'])) {
      $error_type = t('Missing flipdown library');
      $error_message = t('Library not found in the "libraries" directory.');
      if (empty($library['installed'])) {
        $requirements['drowl_paragraphs_bs_type_countdown'] = [
          'title' => t('DROWL Paragraphs for Bootstrap Type: Countdown'),
          'value' => t('@e: At least @a', [
            '@e' => $error_type,
            '@a' => 'v0.3',
          ]),
          'severity' => REQUIREMENT_ERROR,
          'description' => t('@error You need to download the <a href=":url" target="_blank">Flipdown library</a>, extract the archive and place it in the the %path directory on your server. Ensure the following files to exist: "/libraries/flipdown/dist/flipdown.min.js", "/libraries/flipdown/dist/flipdown.min.css". Alternatively use ´composer require npm-asset/flipdown´.', [
            '@error' => $error_message,
            ':url' => 'https://github.com/PButcher/flipdown',
            '%path' => 'libraries',
          ]),
        ];
      }
    }
  }

  return $requirements;
}

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

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