You are here

class MappingStepService 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

Class MappingStepFactory.

@package Drupal\gathercontent_ui\Form\MappingEditSteps

Hierarchy

Expanded class hierarchy of MappingStepService

1 file declares its use of MappingStepService
MappingEditForm.php in gathercontent_ui/src/Form/MappingEditForm.php
1 string reference to 'MappingStepService'
gathercontent_ui.services.yml in gathercontent_ui/gathercontent_ui.services.yml
gathercontent_ui/gathercontent_ui.services.yml
1 service uses MappingStepService
gathercontent_ui.mapping_service in gathercontent_ui/gathercontent_ui.services.yml
Drupal\gathercontent_ui\Form\MappingEditSteps\MappingStepService

File

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

Namespace

Drupal\gathercontent_ui\Form\MappingEditSteps
View source
class MappingStepService {

  /**
   * New step.
   *
   * @var null|object
   */
  protected $newStep;

  /**
   * Edit step.
   *
   * @var null|object
   */
  protected $editStep;

  /**
   * Entity reference step.
   *
   * @var null|object
   */
  protected $entityReferenceStep;

  /**
   * Returns new step object.
   *
   * @param \Drupal\gathercontent\Entity\MappingInterface $mapping
   *   Mapping object.
   * @param array $template
   *   Template array.
   *
   * @return \Drupal\gathercontent_ui\Form\MappingEditSteps\MappingStepNew
   *   MappingStepNew object.
   */
  public function getNewStep(MappingInterface $mapping, array $template) {
    if ($this->newStep === NULL) {
      $this->newStep = new MappingStepNew($mapping, $template);
    }
    return $this->newStep;
  }

  /**
   * Returns new step object.
   *
   * @param \Drupal\gathercontent\Entity\MappingInterface $mapping
   *   Mapping object.
   * @param array $template
   *   Template array.
   *
   * @return \Drupal\gathercontent_ui\Form\MappingEditSteps\MappingStepEdit
   *   MappingStepEdit object.
   */
  public function getEditStep(MappingInterface $mapping, array $template) {
    if ($this->editStep === NULL) {
      $this->editStep = new MappingStepEdit($mapping, $template);
    }
    return $this->editStep;
  }

  /**
   * Returns new step object.
   *
   * @param \Drupal\gathercontent\Entity\MappingInterface $mapping
   *   Mapping object.
   * @param array $template
   *   Template array.
   *
   * @return \Drupal\gathercontent_ui\Form\MappingEditSteps\MappingStepEntityReference
   *   MappingStepEntityReference object.
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MappingStepService::$editStep protected property Edit step.
MappingStepService::$entityReferenceStep protected property Entity reference step.
MappingStepService::$newStep protected property New step.
MappingStepService::getEditStep public function Returns new step object.
MappingStepService::getEntityReferenceStep public function Returns new step object.
MappingStepService::getNewStep public function Returns new step object.