serial.install in Serial Field 8
Same filename and directory in other branches
Install, update and uninstall functions for the Serial module.
File
serial.installView 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
Name | Description |
---|---|
serial_schema | Implements hook_schema(). |