You are here

class MappingStepService in GatherContent 8.4

Same name and namespace in other branches
  1. 8.5 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 13

Namespace

Drupal\gathercontent_ui\Form\MappingEditSteps
View source
class MappingStepService {
  protected $newStep;
  protected $editStep;
  protected $entityReferenceStep;

  /**
   * Returns new step object.
   *
   * @param \Drupal\gathercontent\Entity\MappingInterface $mapping
   *   Mapping object.
   * @param \Cheppers\GatherContent\DataTypes\Template $template
   *   Template object.
   *
   * @return \Drupal\gathercontent_ui\Form\MappingEditSteps\MappingStepNew
   *   MappingStepNew object.
   */
  public function getNewStep(MappingInterface $mapping, Template $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 \Cheppers\GatherContent\DataTypes\Template $template
   *   Template object.
   *
   * @return \Drupal\gathercontent_ui\Form\MappingEditSteps\MappingStepEdit
   *   MappingStepEdit object.
   */
  public function getEditStep(MappingInterface $mapping, Template $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 \Cheppers\GatherContent\DataTypes\Template $template
   *   Template object.
   *
   * @return \Drupal\gathercontent_ui\Form\MappingEditSteps\MappingStepEntityReference
   *   MappingStepEntityReference object.
   */
  public function getEntityReferenceStep(MappingInterface $mapping, Template $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
MappingStepService::$entityReferenceStep protected property
MappingStepService::$newStep protected property
MappingStepService::getEditStep public function Returns new step object.
MappingStepService::getEntityReferenceStep public function Returns new step object.
MappingStepService::getNewStep public function Returns new step object.