You are here

public function MappingStepService::getEntityReferenceStep in GatherContent 8.5

Same name and namespace in other branches
  1. 8.4 gathercontent_ui/src/Form/MappingEditSteps/MappingStepService.php \Drupal\gathercontent_ui\Form\MappingEditSteps\MappingStepService::getEntityReferenceStep()

Returns new step object.

Parameters

\Drupal\gathercontent\Entity\MappingInterface $mapping: Mapping object.

array $template: Template array.

Return value

\Drupal\gathercontent_ui\Form\MappingEditSteps\MappingStepEntityReference MappingStepEntityReference object.

File

gathercontent_ui/src/Form/MappingEditSteps/MappingStepService.php, line 84

Class

MappingStepService
Class MappingStepFactory.

Namespace

Drupal\gathercontent_ui\Form\MappingEditSteps

Code

public function getEntityReferenceStep(MappingInterface $mapping, array $template) {
  if ($this->entityReferenceStep === NULL) {
    $this->entityReferenceStep = new MappingStepEntityReference($mapping, $template);
  }
  if ($this->newStep !== NULL) {
    $this->entityReferenceStep
      ->setEntityReferenceFields($this->newStep
      ->getEntityReferenceFields());
    $this->entityReferenceStep
      ->setEntityReferenceFieldsOptions($this->newStep
      ->getEntityReferenceFieldsOptions());
  }
  if ($this->editStep !== NULL) {
    $this->entityReferenceStep
      ->setEntityReferenceFields($this->editStep
      ->getEntityReferenceFields());
    $this->entityReferenceStep
      ->setEntityReferenceFieldsOptions($this->editStep
      ->getEntityReferenceFieldsOptions());
  }
  return $this->entityReferenceStep;
}