You are here

public function WebformEntityReferenceManager::getTableNames in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformEntityReferenceManager.php \Drupal\webform\WebformEntityReferenceManager::getTableNames()

Get the table names for all webform field instances.

Return value

array An associative array of webform field table names and webform field names.

Overrides WebformEntityReferenceManagerInterface::getTableNames

File

src/WebformEntityReferenceManager.php, line 348

Class

WebformEntityReferenceManager
Webform entity reference (field) manager.

Namespace

Drupal\webform

Code

public function getTableNames() {

  /** @var \Drupal\field\FieldStorageConfigInterface[] $field_storage_configs */
  $field_storage_configs = FieldStorageConfig::loadMultiple();
  $tables = [];
  foreach ($field_storage_configs as $field_storage_config) {
    if ($field_storage_config
      ->getType() === 'webform') {
      $webform_field_table = $field_storage_config
        ->getTargetEntityTypeId();
      $webform_field_name = $field_storage_config
        ->getName();
      $tables[$webform_field_table . '__' . $webform_field_name] = $webform_field_name;
      $tables[$webform_field_table . '_revision__' . $webform_field_name] = $webform_field_name;
    }
  }
  return $tables;
}