You are here

public function BundlePluginHandler::getFieldStorageDefinitions in Entity API 8

Gets the field storage definitions.

Overrides BundlePluginHandlerInterface::getFieldStorageDefinitions

File

src/BundlePlugin/BundlePluginHandler.php, line 67

Class

BundlePluginHandler

Namespace

Drupal\entity\BundlePlugin

Code

public function getFieldStorageDefinitions() {
  $definitions = [];
  foreach (array_keys($this->pluginManager
    ->getDefinitions()) as $plugin_id) {
    $plugin = $this->pluginManager
      ->createInstance($plugin_id);
    assert($plugin instanceof BundlePluginInterface);
    $definitions += $plugin
      ->buildFieldDefinitions();
  }

  // Ensure the presence of required keys which aren't set by the plugin.
  foreach ($definitions as $field_name => $definition) {
    $definition
      ->setName($field_name);
    $definition
      ->setTargetEntityTypeId($this->entityType
      ->id());
    $definitions[$field_name] = $definition;
  }
  return $definitions;
}