function _field_sql_storage_tablename

Generates a table name for a field data table.

When a field is a deleted, the table is renamed to {field_deleted_data_FIELD_UUID}. To make sure we don't end up with table names longer than 64 characters, we hash the uuid and return the first 10 characters so we end up with a short unique ID.

Parameters

$field: The field structure.

Return value

A string containing the generated name for the database table.

25 calls to _field_sql_storage_tablename()
ApiDataTest::testViewsData in drupal/core/modules/field/lib/Drupal/field/Tests/Views/ApiDataTest.php
Unit testing the views data structure.
ContactFieldsTest::testViewsData in drupal/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php
Tests the views data generation.
FieldSqlStorageTest::setUp in drupal/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
Sets up Drupal unit test environment.
FieldSqlStorageTest::testFieldStorageDetails in drupal/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
Test the storage details.
FieldSqlStorageTest::testFieldUpdateIndexesWithData in drupal/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
Test adding and removing indexes while data is present.

... See full list

1 string reference to '_field_sql_storage_tablename'
hook_field_storage_query in drupal/core/modules/field/field.api.php
Execute a Drupal\Core\Entity\EntityFieldQuery.

File

drupal/core/modules/field_sql_storage/field_sql_storage.module, line 52
Default implementation of the field storage API.

Code

function _field_sql_storage_tablename($field) {
  if ($field['deleted']) {
    return "field_deleted_data_" . substr(hash('sha256', $field['uuid']), 0, 10);
  }
  else {
    return "field_data_{$field['field_name']}";
  }
}