function calendar_systems_requirements in Calendar Systems 7
Same name and namespace in other branches
- 8 calendar_systems.install \calendar_systems_requirements()
- 6.2 calendar_systems.install \calendar_systems_requirements()
- 7.3 calendar_systems.install \calendar_systems_requirements()
- 7.2 calendar_systems.install \calendar_systems_requirements()
Implements hook_requirements().
File
- ./calendar_systems.install, line 61 
- Contains Calendar Systems installation hooks.
Code
function calendar_systems_requirements($phase) {
  require_once dirname(__FILE__) . '/calendar_systems.module';
  $requirements = array();
  // Ensure translations don't break at install time
  $t = get_t();
  if ($phase == 'runtime' || $phase == 'install') {
    $requirements['calendar_systems_patch'] = array(
      'title' => $t('Calendar Systems core patch'),
      'value' => $t('Core patch is not applied, please follow the instructions in <a href="!readme-link">README.txt</a> file.', array(
        '!readme-link' => url(drupal_get_path('module', 'calendar_systems') . '/README.txt', array(
          'language' => (object) array(
            'language' => FALSE,
          ),
        )),
      )),
      'description' => $t('Required core patch for calendar systems to fully work'),
      'severity' => REQUIREMENT_WARNING,
    );
    if (_calendar_systems_is_patch_applied(FALSE) === TRUE) {
      $requirements['calendar_systems_patch']['value'] = $t('Core patch is applied');
      $requirements['calendar_systems_patch']['severity'] = REQUIREMENT_OK;
    }
    elseif (_calendar_systems_is_patch_applied(FALSE) == 'outdated') {
      $requirements['calendar_systems_patch']['value'] = $t('Core patch is applied but it\'s outdated, please follow the instructions in <a href="!readme-link">README.txt</a> file.', array(
        '!readme-link' => url(drupal_get_path('module', 'calendar_systems') . '/README.txt'),
      ));
      $requirements['calendar_systems_patch']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $requirements;
}