You are here

courier.install in Courier 2.x

Same filename and directory in other branches
  1. 8 courier.install

Install functions for courier.

File

courier.install
View source
<?php

/**
 * @file
 * Install functions for courier.
 */

/**
 * Implements hook_requirements().
 */
function courier_requirements($phase) {
  $requirements = [];
  if ($phase == 'runtime') {
    $count = \Drupal::entityTypeManager()
      ->getStorage('courier_message_queue_item')
      ->getQuery()
      ->count()
      ->execute();
    $requirements['courier'] = [
      'title' => t('Courier'),
      'severity' => REQUIREMENT_INFO,
      'value' => \Drupal::translation()
        ->formatPlural($count, '@count item in queue.', '@count items in queue.'),
    ];
  }
  return $requirements;
}

/**
 * Install global template collection entity.
 */
function courier_update_8001() {
  $entity_manager = \Drupal::entityTypeManager();
  $update_manager = \Drupal::entityDefinitionUpdateManager();
  $entity_type = $entity_manager
    ->getDefinition('template_collection_global');
  $update_manager
    ->installEntityType($entity_type);
}

Functions

Namesort descending Description
courier_requirements Implements hook_requirements().
courier_update_8001 Install global template collection entity.