You are here

trait ParagraphFormHelperTrait in Paragraphs Edit 8.2

Provides a helper for paragraph forms.

Hierarchy

3 files declare their use of ParagraphFormHelperTrait
ParagraphCloneForm.php in src/Form/ParagraphCloneForm.php
ParagraphDeleteForm.php in src/Form/ParagraphDeleteForm.php
ParagraphEditForm.php in src/Form/ParagraphEditForm.php

File

src/ParagraphFormHelperTrait.php, line 11

Namespace

Drupal\paragraphs_edit
View source
trait ParagraphFormHelperTrait {
  private $lineageInspector;
  private $lineageRevisioner;
  protected $rootParent;

  /**
   * Returns the lineage inspector service.
   *
   * @return \Drupal\paragraphs_edit\ParagraphLineageInspector
   *   The lineage inspector service data.
   */
  protected function lineageInspector() {
    if (!isset($this->lineageInspector)) {
      $this->lineageInspector = \Drupal::service('paragraphs_edit.lineage.inspector');
    }
    return $this->lineageInspector;
  }

  /**
   * Returns the lineage revisioner service.
   *
   * @return \Drupal\paragraphs_edit\ParagraphLineageRevisioner|null
   *   The lineage revisioner service data.
   */
  protected function lineageRevisioner() {
    if (!isset($this->lineageRevisioner)) {
      $this->lineageRevisioner = \Drupal::service('paragraphs_edit.lineage.revisioner');
    }
    return $this->lineageRevisioner;
  }

  /**
   * {@inheritdoc}
   *
   * Overridden to store the root parent entity.
   */
  public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $root_parent = NULL) {
    $this->rootParent = $root_parent;
    return parent::buildForm($form, $form_state);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ParagraphFormHelperTrait::$lineageInspector private property
ParagraphFormHelperTrait::$lineageRevisioner private property
ParagraphFormHelperTrait::$rootParent protected property
ParagraphFormHelperTrait::buildForm public function Overridden to store the root parent entity.
ParagraphFormHelperTrait::lineageInspector protected function Returns the lineage inspector service.
ParagraphFormHelperTrait::lineageRevisioner protected function Returns the lineage revisioner service.