You are here

function total_control_requirements in Total Control Admin Dashboard 6

Same name and namespace in other branches
  1. 6.2 total_control.install \total_control_requirements()
  2. 7.2 total_control.install \total_control_requirements()

File

./total_control.install, line 7

Code

function total_control_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break at install time
  $t = get_t();

  // Handle install
  if ($phase == 'install') {

    // Views 2
    if (function_exists('views_api_version')) {
      $views_major = intval(views_api_version());
    }
    else {
      $views_major = 0;
    }
    if ($views_major < 2) {
      $requirements['views'] = array(
        'title' => $t('Views'),
        'description' => t('Total Control requires Views 2'),
        'value' => $views_major,
        'severity' => REQUIREMENT_ERROR,
      );
    }

    // Panels 3
    if (function_exists('panels_api_version')) {
      $panels_major = intval(array_shift(panels_api_version()));
    }
    else {
      $panels_major = 0;
    }
    if ($panels_major < 3) {
      $requirements['panels'] = array(
        'title' => $t('Panels'),
        'description' => t('Total Control requires Panels 3'),
        'value' => $panels_major,
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}