You are here

function mmenu_requirements in Mobile sliding menu 8

Same name and namespace in other branches
  1. 7.3 mmenu.install \mmenu_requirements()
  2. 7 mmenu.install \mmenu_requirements()
  3. 7.2 mmenu.install \mmenu_requirements()

Implements hook_requirements().

File

./mmenu.install, line 32
Install and uninstall functions for the mobile sliding menu module.

Code

function mmenu_requirements($phase) {
  $requirements = array();
  switch ($phase) {
    case 'runtime':
      $library_main = libraries_detect('mmenu.main');
      $library_hammer = libraries_detect('mmenu.hammer');
      $library_jquery_hammer = libraries_detect('mmenu.jquery.hammer');
      $description_installed = t('To check for newer versions of Mmenu, go to <a href=":url" target="_blank">:url</a>.', array(
        ":url" => $library_main['vendor url'],
      ));
      $description_missing = t('To check for newer versions of Mmenu, go to <a href=":lib_url" target="_blank">:lib_url</a>. The Mmenu library was not detected. Please follow the instructions on the <a href=":url" target="_blank">Mmenu project page</a> to install the Mmenu library.', array(
        ":lib_url" => $library_main['vendor url'],
        ":url" => 'http://drupal.org/project/mmenu',
      ));
      if (!empty($library_main['installed'])) {
        $requirements['mmenu_main_version'] = array(
          'title' => t('Mmenu: Main'),
          'value' => $library_main['version'],
          'description' => $description_installed,
          'severity' => REQUIREMENT_OK,
        );
      }
      else {
        $requirements['mmenu_main_library'] = array(
          'title' => t('Mmenu: Main'),
          'value' => t('Missing'),
          'description' => $description_missing,
          'severity' => REQUIREMENT_ERROR,
        );
      }
      $description_installed = t('To check for newer versions of Hammer.js, go to <a href=":url" target="_blank">:url</a>.', array(
        ":url" => $library_hammer['vendor url'],
      ));
      $description_missing = t('To check for newer versions of Hammer.js, go to <a href=":lib_url" target="_blank">:lib_url</a>. The Hammer.js library was not detected. Please follow the instructions on the <a href=":url" target="_blank">Mmenu project page</a> to install the library.', array(
        ":lib_url" => $library_hammer['vendor url'],
        ":url" => 'http://drupal.org/project/mmenu',
      ));
      if (!empty($library_hammer['installed'])) {
        $requirements['mmenu_hammer_version'] = array(
          'title' => t('Mmenu: Hammer.js'),
          'value' => $library_hammer['version'],
          'description' => $description_installed,
          'severity' => REQUIREMENT_OK,
        );
      }
      else {
        $requirements['mmenu_hammer_library'] = array(
          'title' => t('Mmenu: Hammer.js'),
          'value' => t('Missing'),
          'description' => $description_missing,
          'severity' => REQUIREMENT_ERROR,
        );
      }
      $description_installed = t('To check for newer versions of jQuery plugin for Hammer.js, go to <a href=":url" target="_blank">:url</a>.', array(
        ":url" => $library_jquery_hammer['vendor url'],
      ));
      $description_missing = t('To check for newer versions of jQuery plugin for Hammer.js, go to <a href=":lib_url" target="_blank">:lib_url</a>. The jQuery plugin for Hammer.js library was not detected. Please follow the instructions on the <a href=":url" target="_blank">Mmenu project page</a> to install the library.', array(
        ":lib_url" => $library_jquery_hammer['vendor url'],
        ":url" => 'http://drupal.org/project/mmenu',
      ));
      if (!empty($library_jquery_hammer['installed'])) {
        $requirements['mmenu_jquery_hammer_version'] = array(
          'title' => t('Mmenu: jQuery plugin for Hammer.js'),
          'value' => $library_jquery_hammer['version'],
          'description' => $description_installed,
          'severity' => REQUIREMENT_OK,
        );
      }
      else {
        $requirements['mmenu_jquery_hammer_library'] = array(
          'title' => t('Mmenu: jQuery plugin for Hammer.js'),
          'value' => t('Missing'),
          'description' => $description_missing,
          'severity' => REQUIREMENT_ERROR,
        );
      }
      break;
  }
  return $requirements;
}