function drupalmonitor_install in Drupalmonitor 8
Implements hook_enable().
File
- ./
drupalmonitor.install, line 32 - Installer file of drupalmonitor module
Code
function drupalmonitor_install() {
// Generate Hash.
$hash = md5(microtime() . 'drupalmonitorrocks_salt' . time());
$config = \Drupal::service('config.factory')
->getEditable(Settings::CONFIG_NAME);
$config
->set('drupalmonitor_hash', $hash);
$config
->save();
$message = t("You need to create an account on http://www.drupalmonitor.com in order to monitor your website. The sites security hash is @hash. You can configure Drupalmonitor Connector on the @configurl.", [
'@hash' => $hash,
'@configurl' => '/admin/config/system/drupalmonitor',
]);
\Drupal::messenger()
->addMessage($message);
}