function diff_requirements in Diff 8
Same name and namespace in other branches
- 5.2 diff.module \diff_requirements()
- 5 diff.module \diff_requirements()
Implements hook_requirements().
1 call to diff_requirements()
- DiffAdminFormsTest::testRequirements in tests/
src/ Functional/ DiffAdminFormsTest.php - Tests the module requirements.
File
- ./
diff.install, line 13 - Installation hooks for diff module.
Code
function diff_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
$config = \Drupal::config('diff.settings');
$setting_enabled = $config
->get('general_settings.layout_plugins.visual_inline.enabled');
$has_htmlDiffAdvanced = class_exists('\\HtmlDiffAdvanced');
$requirements['html_diff_advanced'] = [
'title' => t('Diff'),
'value' => t('Installed correctly'),
'description' => t('Diff module has been installed correctly.'),
];
if (!$has_htmlDiffAdvanced) {
if ($setting_enabled) {
$requirements['html_diff_advanced']['value'] = t('Dependencies not found');
$requirements['html_diff_advanced']['severity'] = REQUIREMENT_ERROR;
$requirements['html_diff_advanced']['description'] = t("The HTML Diff layout requires the HtmlDiffAdvanced library. Please consult README.txt for installation instructions.");
}
else {
$requirements['html_diff_advanced']['value'] = t('Visual inline layout');
$requirements['html_diff_advanced']['severity'] = REQUIREMENT_INFO;
$requirements['html_diff_advanced']['description'] = t('Diff adds a visual rendered display, consult README.txt for installation instructions and enable it in <a href=":settings">settings</a>.', [
':settings' => Url::fromRoute('diff.general_settings')
->toString(),
]);
}
}
}
return $requirements;
}