You are here

public static function ConvertNodes::getFieldTableNames in Convert Nodes 8

1 call to ConvertNodes::getFieldTableNames()
ConvertNodesForm::convertNodes in src/Form/ConvertNodesForm.php

File

src/ConvertNodes.php, line 148

Class

ConvertNodes
ConvertNodes.

Namespace

Drupal\convert_nodes

Code

public static function getFieldTableNames($fields_from) {
  $table_mapping = \Drupal::service('entity_type.manager')
    ->getStorage('node')
    ->getTableMapping();
  $field_table_names = [];
  foreach ($fields_from as $field) {
    if ($field
      ->getFieldStorageDefinition()
      ->isBaseField() == FALSE) {
      $field_name = $field
        ->getName();
      $field_table = $table_mapping
        ->getFieldTableName($field_name);
      $field_table_names[$field_name] = $field_table;
      $field_storage_definition = $field
        ->getFieldStorageDefinition();
      $field_revision_table = $table_mapping
        ->getDedicatedRevisionTableName($field_storage_definition);

      // Field revision tables DO have the bundle!
      $field_table_names[$field_name . '_revision'] = $field_revision_table;
    }
  }
  return $field_table_names;
}