You are here

bootstrap_languages.install in Bootstrap Languages 7

Same filename and directory in other branches
  1. 8 bootstrap_languages.install

Install, update, and uninstall functions for the bootstrap_languages module.

File

bootstrap_languages.install
View source
<?php

/**
 * @file
 * Install, update, and uninstall functions for the bootstrap_languages module.
 */

/**
 * Implements hook_install().
 */
function bootstrap_languages_install() {
  $block_default_settings = array(
    'show_all' => 1,
    'btn_type' => 'btn-default',
  );
  variable_set('bootstrap_languages_block_settings', $block_default_settings);
}

/**
 * Implements hook_install().
 */
function bootstrap_languages_uninstall() {
  variable_del('bootstrap_languages_block_settings');
}

/**
 * Implements hook_requirements().
 */
function bootstrap_languages_requirements($phase) {
  $t = get_t();
  $requirements = array();
  $url = 'https://github.com/usrz/bootstrap-languages';
  switch ($phase) {
    case 'runtime':
      $bootstrap_languages_library = libraries_load('bootstrap-languages');
      if (!$bootstrap_languages_library['loaded']) {
        $requirements['bootstrap_languages'] = array(
          'title' => $t('Bootstrap languages library'),
          'value' => $t('Not installed'),
          'description' => $t('The bootstrap languages library could not be loaded. Please install <a href="@url" target="_blank">Bootstrap languages library</a>.', array(
            '@url' => $url,
          )),
          'severity' => REQUIREMENT_ERROR,
        );
      }
      break;
  }
  return $requirements;
}