You are here

public function EntityFormDisplay::getPluginCollections in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php \Drupal\Core\Entity\Entity\EntityFormDisplay::getPluginCollections()

Gets the plugin collections used by this object.

Return value

\Drupal\Component\Plugin\LazyPluginCollection[] An array of plugin collections, keyed by the property name they use to store their configuration.

Overrides ObjectWithPluginCollectionInterface::getPluginCollections

File

core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php, line 328

Class

EntityFormDisplay
Configuration entity that contains widget options for all components of a entity form in a given form mode.

Namespace

Drupal\Core\Entity\Entity

Code

public function getPluginCollections() {
  $configurations = [];
  foreach ($this
    ->getComponents() as $field_name => $configuration) {
    if (!empty($configuration['type']) && ($field_definition = $this
      ->getFieldDefinition($field_name))) {
      $configurations[$configuration['type']] = $configuration + [
        'field_definition' => $field_definition,
        'form_mode' => $this->mode,
      ];
    }
  }
  return [
    'widgets' => new EntityDisplayPluginCollection($this->pluginManager, $configurations),
  ];
}