You are here

views_revisions.install in Config Entity Revisions 8

Same filename and directory in other branches
  1. 1.x modules/views_revisions/views_revisions.install

File

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

use Drupal\Core\Config\Entity\ConfigEntityStorage;

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

/**
 * Implements hook_uninstall().
 */
function views_revisions_uninstall() {
  $entityTypeManager = \Drupal::entityTypeManager();
  $cert_storage = $entityTypeManager
    ->getStorage('config_entity_revisions_type');
  $entity = $cert_storage
    ->load('views_revisions');
  $cert_storage
    ->delete([
    $entity,
  ]);
}

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

Functions

Namesort descending Description
views_revisions_install Implements hook_install().
views_revisions_uninstall Implements hook_uninstall().
view_revisions_8000 Implements hook_update.