function serial_schema in Serial Field 8
Same name and namespace in other branches
- 6 serial.install \serial_schema()
- 7 serial.install \serial_schema()
Implements hook_schema().
Return the schema of all the assistant tables (one per field instance).
File
- ./
serial.install, line 13 - Install, update and uninstall functions for the Serial module.
Code
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;
}