calendar_systems.install in Calendar Systems 8.2
Contains Calendar Systems installation hooks.
Namespace
Drupal\calendar_systemsFile
calendar_systems.installView source
<?php
namespace Drupal\calendar_systems;
use Drupal\calendar_systems\Helpers;
/**
* @file
* Contains Calendar Systems installation hooks.
*/
/**
* Implements hook_enable().
*/
function calendar_systems_enable() {
\Drupal::messenger()
->addWarning($this
->t('There is a problem with calendar systems installation, please visit <a href=":readme-link">site status page</a> for more information.', [
':readme-link' => \Drupal\Core\Url::fromRoute('system.status'),
]));
}
/**
* Implements hook_requirements().
*/
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;
}
/**
* Implements hook_uninstall().
*/
function calendar_systems_uninstall() {
\Drupal::configFactory()
->getEditable('calendar_systems.settings')
->delete()
->save();
}
Functions
Name![]() |
Description |
---|---|
calendar_systems_enable | Implements hook_enable(). |
calendar_systems_requirements | Implements hook_requirements(). |
calendar_systems_uninstall | Implements hook_uninstall(). |