You are here

message.install in Message 8

Same filename and directory in other branches
  1. 6 message.install
  2. 7 message.install

Install, update, and uninstall functions for the message module.

File

message.install
View source
<?php

/**
 * @file
 * Install, update, and uninstall functions for the message module.
 */

/**
 * Implements hook_uninstall().
 */
function message_uninstall() {

  // Delete all message settings variables.
  \Drupal::configFactory()
    ->getEditable('message.settings')
    ->delete();
}

/**
 * Fixes the typo in 'adminster messages' permission.
 */
function message_update_8100() {
  $entityTypeManager = \Drupal::service('entity_type.manager');
  $roles = $entityTypeManager
    ->getStorage('user_role')
    ->loadMultiple();
  foreach ($roles as $role) {
    if ($role
      ->hasPermission('adminster messages')) {
      $role
        ->revokePermission('adminster messages');
      $role
        ->grantPermission('administer messages');
      $role
        ->save();
    }
  }
}

Functions

Namesort descending Description
message_uninstall Implements hook_uninstall().
message_update_8100 Fixes the typo in 'adminster messages' permission.