You are here

total_control.install in Total Control Admin Dashboard 6

File

total_control.install
View source
<?php

/* 
 * Implementation of hook_requirements
 * adds versions to module requirements
 */
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;
}

Functions