You are here

serial.install in Serial Field 8

Same filename and directory in other branches
  1. 6 serial.install
  2. 7 serial.install

Install, update and uninstall functions for the Serial module.

File

serial.install
View source
<?php

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

/**
 * Implements hook_schema().
 *
 * Return the schema of all the assistant tables (one per field instance).
 */
function serial_schema() {

  /** @var \Drupal\serial\SerialStorageInterface $serialStorage */
  $serialStorage = \Drupal::getContainer()
    ->get('serial.sql_storage');
  $tableSchema = $serialStorage
    ->getSchema();
  $schema = [];
  foreach ($serialStorage
    ->getAllFields() as $entityTypeId => $entry) {
    foreach ($entry as $fieldKey => $fieldInstance) {
      foreach ($fieldInstance['bundles'] as $bundle) {
        $schema[$serialStorage
          ->createStorageName($entityTypeId, $bundle, $fieldKey)] = $tableSchema;
      }
    }
  }
  return $schema;
}

Functions

Namesort descending Description
serial_schema Implements hook_schema().