popup_message.install in Popup message 8
Same filename and directory in other branches
Install, update and uninstall functions for the Popup message module.
File
popup_message.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Popup message module.
*/
use Drupal\user\RoleInterface;
/**
* Implements hook_uninstall().
*/
function popup_message_install() {
\Drupal::messenger()
->addMessage(t('Popup message: Go to "Configuration -> User interface -> Popup message" and set popup message title and body'));
// Set default settings - permission, hidden on admin pages.
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, [
'display popup message',
]);
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, [
'display popup message',
]);
$config = Drupal::configFactory()
->getEditable('popup_message.settings');
$config
->set('visibility_pages', 'admin/*')
->save();
}
/**
* Implements hook_uninstall().
*/
function popup_message_uninstall() {
Drupal::configFactory()
->getEditable('popup_message.settings')
->delete();
}
Functions
Name | Description |
---|---|
popup_message_install | Implements hook_uninstall(). |
popup_message_uninstall | Implements hook_uninstall(). |