You are here

function mobile_switch_block_requirements in Mobile Switch Block 7

Same name and namespace in other branches
  1. 6 mobile_switch_block.install \mobile_switch_block_requirements()

Implements hook_requirements().

File

./mobile_switch_block.install, line 10
Install, update and uninstall functions for the Mobile Switch Block module.

Code

function mobile_switch_block_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $requirements['mobile_switch']['value'] = '';
  $info = drupal_parse_info_file(drupal_get_path('module', 'mobile_switch') . '/mobile_switch.info');
  switch ($phase) {
    case 'install':

      // Ensure Mobile Switch module version.
      // Release datestamps or+ are ok:
      // 7.x-1.4: 1348671046
      // dev:     1348621394
      if ($info['datestamp'] < 1348621394) {
        $requirements['mobile_switch'] = array(
          'severity' => REQUIREMENT_ERROR,
          'description' => $t('<em>Mobile Switch Block</em> module: The version of the required <em>Mobile Switch</em> module is too low. Please update this module.'),
        );
      }
      else {
        $requirements['mobile_switch'] = array(
          'severity' => REQUIREMENT_OK,
        );
      }
      break;
  }
  $requirements['mobile_switch']['value'] = $t('!version', array(
    '!version' => $info['version'],
  ));
  $requirements['mobile_switch']['title'] = $t('<em>Mobile Switch</em> module');
  return $requirements;
}