You are here

public function FlexiformEntityFormDisplay::initFormEntityConfig in Flexiform 8

1 call to FlexiformEntityFormDisplay::initFormEntityConfig()
FlexiformEntityFormDisplay::getFormEntityConfig in src/FlexiformEntityFormDisplay.php
Get the Flexiform form Entity Configuration from the object.

File

src/FlexiformEntityFormDisplay.php, line 450

Class

FlexiformEntityFormDisplay
Defines a class to extend EntityFormDisplays.

Namespace

Drupal\flexiform

Code

public function initFormEntityConfig() {
  if (empty($this->formEntities)) {
    $this->formEntities = [];
    $form_entities = [];
    foreach ($this
      ->getFormEnhancers('init_form_entity_config') as $enhancer) {
      $form_entities += $enhancer
        ->initFormEntityConfig();
    }

    // If there is a base entity add it to the configuration.
    if ($this
      ->getTargetEntityTypeId() && empty($form_entities[$this->baseEntityNamespace])) {
      $this->formEntities[$this->baseEntityNamespace] = [
        'entity_type' => $this
          ->getTargetEntityTypeId(),
        'bundle' => $this
          ->getTargetBundle(),
        'plugin' => 'provided',
        'label' => t('Base @entity_type', [
          '@entity_type' => \Drupal::service('entity_type.manager')
            ->getDefinition($this
            ->getTargetEntityTypeId())
            ->getLabel(),
        ]),
      ];
    }
    $this->formEntities += $form_entities;
  }
}