You are here

mailing_list_confirm.install in Mailing List 8

Install, update and uninstall functions for the mailing_list_confirm module.

File

mailing_list_confirm/mailing_list_confirm.install
View source
<?php

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

/**
 * Implements hook_install().
 */
function mailing_list_confirm_install() {

  // Remove confirmation status field from existent block form display.

  /** @var \Drupal\mailing_list\MailingListInterface $list */
  foreach (\Drupal::entityTypeManager()
    ->getStorage('mailing_list')
    ->loadMultiple() as $list) {

    /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $block_display_mode */
    if ($block_display_mode = \Drupal::entityTypeManager()
      ->getStorage('entity_form_display')
      ->load('mailing_list_subscription.' . $list
      ->id() . '.block')) {
      $block_display_mode
        ->removeComponent('email_confirmation_status');
      $block_display_mode
        ->save();
    }
  }
}

Functions

Namesort descending Description
mailing_list_confirm_install Implements hook_install().