You are here

function variablecheck_requirements in Variable Check 7

Same name and namespace in other branches
  1. 6 variablecheck.module \variablecheck_requirements()

Implementation of hook_requirements()

File

./variablecheck.module, line 38

Code

function variablecheck_requirements($phase) {
  $problem = count(variablecheck_check_variables());
  $requirements = array();
  $requirements['variablecheck'] = array(
    'title' => 'Variables',
    'value' => !empty($problem) ? format_plural($problem, 'One invalid variable', '@count invalid variables') : t('No problem'),
    'description' => !empty($problem) ? t('The variable table contains an invalid entry. Please check the <a href="!url">variable report</a> for more information.', array(
      '!url' => url(VARIABLECHECK_REPORT_PATH),
    )) : '',
    'severity' => !empty($problem) ? REQUIREMENT_WARNING : REQUIREMENT_OK,
  );

  // If the user has no access to the variables admin UI, override the status
  // description and do not include a link!
  if (!empty($problem) && !user_access('check variables')) {
    $requirements['variablecheck']['description'] = t('The variable table contains an invalid entry, but you need %permission permission to access the report.', array(
      '%permission' => 'Check System Variables',
    ));
  }
  return $requirements;
}