simple_gse_search.install in Simple Google Custom Search Engine 2.0.x
Contains the install hooks.
File
simple_gse_search.installView source
<?php
/**
* @file
* Contains the install hooks.
*/
/**
* Implements hook_install().
*/
function simple_gse_search_install() {
$moduleHandler = \Drupal::service('module_handler');
// Display a warning if the search module is enabled.
if ($moduleHandler
->moduleExists('search')) {
\Drupal::messenger()
->addWarning('Core search module is installed! Please uninstall the module for the "Simple Google Custom Search Engine" module to work properly.');
}
}
/**
* Implements hook_requirements().
*/
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;
}
Functions
Name | Description |
---|---|
simple_gse_search_install | Implements hook_install(). |
simple_gse_search_requirements | Implements hook_requirements(). |