You are here

function url_alter_requirements in URL alter 6

Implementation of hook_requirements().

1 call to url_alter_requirements()
url_alter_check_status in ./url_alter.install

File

./url_alter.install, line 29
Install and uninstall schema and functions for the url_alter module.

Code

function url_alter_requirements($phase) {
  $requirements = array();
  $t = get_t();
  drupal_load('module', 'url_alter');
  foreach (array(
    'custom_url_rewrite_inbound',
    'custom_url_rewrite_outbound',
  ) as $function) {
    $requirement = array(
      'title' => $t('URL alter'),
    );
    if (defined('URL_ALTER_' . strtoupper($function))) {
      $requirement['value'] = $t('Overriding @function() successfully.', array(
        '@function' => $function,
      ));
    }
    elseif (!url_alter_is_disabled()) {
      $requirement['value'] = $t('Cannot override @function().', array(
        '@function' => $function,
      ));
      $requirement['severity'] = REQUIREMENT_ERROR;
      $info = url_alter_get_function_info($function);
      $requirement['description'] = $t("URL alter cannot override the function @function() because it is already defined (!location). Please comment out or remove the existing function and copy the function's body code into the <a href=\"@url-alter\">URL alter module's settings</a>.", array(
        '@function' => $function,
        '!location' => $info->location ? $info->location : t("usually located in your site's settings.php file"),
        '@url-alter' => url('admin/settings/url-alter'),
      ));
    }
    $requirements['url_alter_' . $function] = $requirement;
  }
  return $requirements;
}