You are here

function panels_requirements_install in Panels 6.3

Same name and namespace in other branches
  1. 7.3 panels.install \panels_requirements_install()

Check install-time requirements.

File

./panels.install, line 14

Code

function panels_requirements_install() {
  $requirements = array();
  $t = get_t();

  // Assume that if the user is running an installation profile that both
  // Panels and CTools are the same release.
  if (!(defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install')) {

    // apparently the install process doesn't include .module files,
    // so we need to force the issue in order for our versioning
    // check to work.
    if (!defined('PANELS_REQUIRED_CTOOLS_API')) {
      include_once drupal_get_path('module', 'panels') . '/panels.module';
    }

    // In theory we should check module_exists, but Drupal's gating should
    // actually prevent us from getting here otherwise.
    if (!defined('CTOOLS_API_VERSION')) {
      include_once drupal_get_path('module', 'ctools') . '/ctools.module';
    }
    if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
      $requirements['panels_ctools'] = array(
        'title' => $t('CTools API Version'),
        'value' => CTOOLS_API_VERSION,
        'severity' => REQUIREMENT_ERROR,
        'description' => t('The CTools API version is too old for Panels. Panels needs at least %version.', array(
          '%version' => PANELS_REQUIRED_CTOOLS_API,
        )),
      );
    }
  }
  return $requirements;
}