You are here

view_revisions.install in Config Entity Revisions 8.2

view_revisions install hooks.

File

modules/view_revisions/view_revisions.install
View source
<?php

/**
 * @file
 * view_revisions install hooks.
 */

/**
 * Implements hook_install().
 */
function view_revisions_install() {
  $entityTypeManager = \Drupal::entityTypeManager();
  $cert_storage = $entityTypeManager
    ->getStorage('config_entity_revisions_type');
  $entity = $cert_storage
    ->create([
    'id' => 'view_revisions',
    'label' => 'View Revisions',
  ]);
  $entity
    ->save();
}

/**
 * Implements hook_uninstall().
 */
function view_revisions_uninstall() {
  $entityTypeManager = \Drupal::entityTypeManager();
  $cert_storage = $entityTypeManager
    ->getStorage('config_entity_revisions_type');
  $entities = $cert_storage
    ->loadByProperties([
    'type' => 'view_revisions',
  ]);
  if ($entities) {
    $cert_storage
      ->delete([
      $entities,
    ]);
  }
  Drupal::configFactory()
    ->getEditable('config_entity_revisions.config_entity_revisions_type.view_revisions')
    ->delete();
}

/**
 * Implements hook_update().
 */
function view_revisions_8000(&$sandbox) {
  $entityTypeManager = \Drupal::entityTypeManager();
  $cert_storage = $entityTypeManager
    ->getStorage('config_entity_revisions_type');
  $entity = $cert_storage
    ->create([
    'id' => 'view_revisions',
  ]);
  $entity
    ->save();
}

Functions

Namesort descending Description
view_revisions_8000 Implements hook_update().
view_revisions_install Implements hook_install().
view_revisions_uninstall Implements hook_uninstall().