You are here

function popup_message_install in Popup message 8

Same name and namespace in other branches
  1. 6 popup_message.install \popup_message_install()
  2. 7 popup_message.install \popup_message_install()

Implements hook_uninstall().

File

./popup_message.install, line 13
Install, update and uninstall functions for the Popup message module.

Code

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();
}