You are here

function mobile_tools_requirements in Mobile Tools 6.2

Implementation of hook_requirements().

File

./mobile_tools.install, line 11
Mobile Tools's install and uninstall code.

Code

function mobile_tools_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {

    // Check for a site detection method
    $site_detection = variable_get('mobile-tools-site-type-detection', NULL);
    if (isset($site_detection)) {
      $requirements['mobile_tools_site_detection'] = array(
        'title' => t('Site detection'),
        'value' => t('Configured'),
        'severity' => REQUIREMENT_OK,
        'description' => t('A site detection method has been configured.'),
      );
    }
    else {
      $requirements['mobile_tools_site_detection'] = array(
        'title' => t('Site detection'),
        'value' => t('Not configured'),
        'severity' => REQUIREMENT_WARNING,
        'description' => t('A site detection method has not been configured. You can configure a site detection method on the <a href="@url">detection</a> page.', array(
          '@url' => '/admin/settings/mobile-tools/detection',
        )),
      );
    }

    // Check for a device detection method
    $device_detection = variable_get('mobile-tools-device-detection', NULL);
    if (isset($device_detection)) {
      $requirements['mobile_tools_device_detection'] = array(
        'title' => t('Device detection'),
        'value' => t('Configured'),
        'severity' => REQUIREMENT_OK,
        'description' => t('A device detection method has been configured.'),
      );
    }
    else {
      $requirements['mobile_tools_device_detection'] = array(
        'title' => t('Device detection'),
        'value' => t('Not configured'),
        'severity' => REQUIREMENT_WARNING,
        'description' => t('A device detection method has not been configured. You can configure a device detection method on the <a href="@url">detection</a> page.', array(
          '@url' => '/admin/settings/mobile-tools/detection',
        )),
      );
    }

    // Check for a device capabilities detection method
    $device_capabilities_detection = variable_get('mobile-tools-device-capabilities', NULL);
    if (isset($device_capabilities_detection)) {
      $requirements['mobile_tools_device_capabilities_detection'] = array(
        'title' => t('Device capabilities'),
        'value' => t('Configured'),
        'severity' => REQUIREMENT_OK,
        'description' => t('A device capabilities detection method has been configured.'),
      );
    }
    else {
      $requirements['mobile_tools_device_capabilities_detection'] = array(
        'title' => t('Device capabilities'),
        'value' => t('Not configured'),
        'severity' => REQUIREMENT_WARNING,
        'description' => t('A device capabilities detection method has not been configured. You can configure a device capabilities detection method on the <a href="@url">detection</a> page.', array(
          '@url' => '/admin/settings/mobile-tools/detection',
        )),
      );
    }
  }
  return $requirements;
}