message_ui.install in Message UI 8
File
message_ui.installView source
<?php
/**
* @file
* message_ui.install
*/
/**
* Implements hook_install().
*/
function message_ui_install() {
// Set the fields for the of the message form.
$templates = \Drupal::entityTypeManager()
->getStorage('message_template')
->loadMultiple();
/** @var \Drupal\message_ui\MessageUIFieldDisplayManagerServiceInterface $message_ui_field_display_manager */
$message_ui_field_display_manager = \Drupal::service('message_ui.field_display_manager');
foreach (array_keys($templates) as $template) {
$message_ui_field_display_manager
->setFieldsDisplay($template);
}
}
/**
* Implements hook_uninstall().
*/
function message_ui_uninstall() {
// Removing the contextual links operations handler.
if ($entity = \Drupal::entityTypeManager()
->getStorage('view')
->load('message')) {
$display = $entity
->get('display');
unset($display['default']['display_options']['fields']['message_ui_contextual_links']);
$entity
->set('display', $display);
$entity
->save();
}
}
Functions
Name | Description |
---|---|
message_ui_install | Implements hook_install(). |
message_ui_uninstall | Implements hook_uninstall(). |