You are here

function calendar_systems_requirements in Calendar Systems 8.2

Implements hook_requirements().

File

./calendar_systems.install, line 21
Contains Calendar Systems installation hooks.

Namespace

Drupal\calendar_systems

Code

function calendar_systems_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime' || $phase == 'install') {
    $requirements['calendar_systems_patch'] = [
      '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' => base_path() . 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 (Helpers::_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 (Helpers::_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' => base_path() . drupal_get_path('module', 'calendar_systems') . '/README.txt',
      ));
      $requirements['calendar_systems_patch']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $requirements;
}