You are here

bootstrap_library.install in Bootstrap Library 8

Same filename and directory in other branches
  1. 7 bootstrap_library.install

bootstrap_library.install Installation and update functions for the Bootstrap Library Module

File

bootstrap_library.install
View source
<?php

/**
 * @file bootstrap_library.install
 * Installation and update functions for the Bootstrap Library
 * Module
 */

/**
 * @file
 * Install, update and uninstall functions for the bootstrap module.
 */
use Drupal\Core\Url;
use Drupal\Component\Utility\Unicode;

/**
 * Implements hook_requirements().
 */
function bootstrap_library_requirements($phase) {
  $requirements = array();

  /*
    if ($phase == 'runtime') {
      $library = libraries_detect('bootstrap');
      $error_type = isset($library['error']) ? Unicode::ucfirst($library['error']) : '';
      $error_message = isset($library['error message']) ? $library['error message'] : '';

      if (empty($library['installed'])) {
        $requirements['bootstrap_plugin'] = array(
          'title' => t('Bootstrap plugin'),
          'value' => t('@e: At least @a', array('@e' => $error_type, '@a' => BOOTSTRAP_MIN_PLUGIN_VERSION)),
          'severity' => REQUIREMENT_ERROR,
          'description' => t('!error You need to download the !bootstrap, extract the archive and place the bootstrap directory in the %path directory on your server.', array('!error' => $error_message, '!bootstrap' => \Drupal::l(t('bootstrap plugin'), Url::fromUri($library['download url'])), '%path' => 'sites/all/libraries')),
        );
      }
      elseif (version_compare($library['version'], BOOTSTRAP_MIN_PLUGIN_VERSION, '>=')) {
        $requirements['bootstrap_plugin'] = array(
          'title' => t('Bootstrap plugin'),
          'severity' => REQUIREMENT_OK,
          'value' => $library['version'],
        );
      }
      else {
        $requirements['bootstrap_plugin'] = array(
          'title' => t('Bootstrap plugin'),
          'value' => t('At least @a', array('@a' => BOOTSTRAP_MIN_PLUGIN_VERSION)),
          'severity' => REQUIREMENT_ERROR,
          'description' => t('You need to download a later version of the !bootstrap and replace the old version located in the %path directory on your server.', array('!bootstrap' => \Drupal::l(t('bootstrap plugin'), Url::fromUri($library['download url'])), '%path' => $library['library path'])),
        );
      }
    }
  */
  return $requirements;
}

Functions