sirv-8.x-3.0-beta4/sirv.install
sirv.install
<?php
/**
* @file
* Install, update and uninstall functions for the Sirv module.
*/
use Drupal\Core\Url;
/**
* Implements hook_requirements().
*/
function sirv_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
// Get the site-wide Sirv settings.
$sirv_settings = \Drupal::config('sirv.settings')->get();
// Report if the Sirv domain has been defined.
$requirements['sirv_domain'] = [
'title' => t('Sirv domain'),
];
if (!empty($sirv_settings['domain'])) {
$requirements['sirv_domain']['value'] = t('Defined');
}
else {
$requirements['sirv_domain']['value'] = t('Undefined');
$requirements['sirv_domain']['severity'] = REQUIREMENT_WARNING;
$requirements['sirv_domain']['description'] = t('To allow access to images hosted on Sirv, <a href=":sirv_settings">define the Sirv domain</a> to be the custom domain associated with your Sirv account.', [
':sirv_settings' => Url::fromRoute('sirv.settings')->toString(),
]);
}
}
return $requirements;
}
