function simple_gse_search_requirements in Simple Google Custom Search Engine 2.0.x
Implements hook_requirements().
File
- ./
simple_gse_search.install, line 22 - Contains the install hooks.
Code
function simple_gse_search_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
$requirements['simple_gse_search'] = [
'title' => t('Simple Google Custom Search Engine'),
];
$moduleHandler = \Drupal::service('module_handler');
// Display a warning if the search module is enabled.
if ($moduleHandler
->moduleExists('search')) {
$requirements['simple_gse_search']['severity'] = REQUIREMENT_WARNING;
$requirements['simple_gse_search']['value'] = t('Core search module installed.');
$requirements['simple_gse_search']['description'] = t('Please uninstall the core search module in order for the search from the "Simple Google Custom Search Engine" module to work');
}
else {
$requirements['simple_gse_search']['severity'] = REQUIREMENT_OK;
$requirements['simple_gse_search']['value'] = t('Core search module not installed.');
$requirements['simple_gse_search']['description'] = t('The core search module is not installed. So, the "Simple Google Custom Search Engine" module should work without any issues.');
}
}
return $requirements;
}