public function InsertComponentForm::buildForm in Layout Paragraphs 2.0.x
Parameters
array $form: The form array.
\Drupal\Core\Form\FormStateInterface $form_state: The form state object.
\Drupal\layout_paragraphs\LayoutParagraphsLayout $layout_paragraphs_layout: The layout paragraphs layout object.
\Drupal\paragraphs\Entity\ParagraphsType $paragraph_type: The paragraph type.
string $parent_uuid: The parent component's uuid.
string $region: The region to insert the new component into.
string $sibling_uuid: The uuid of the sibling component.
string $placement: Where to place the new component - either "before" or "after".
Overrides FormInterface::buildForm
File
- src/
Form/ InsertComponentForm.php, line 89
Class
- InsertComponentForm
- Class InsertComponentForm.
Namespace
Drupal\layout_paragraphs\FormCode
public function buildForm(array $form, FormStateInterface $form_state, LayoutParagraphsLayout $layout_paragraphs_layout = NULL, ParagraphsType $paragraph_type = NULL, string $parent_uuid = NULL, string $region = NULL, string $sibling_uuid = NULL, string $placement = NULL) {
$this
->setLayoutParagraphsLayout($layout_paragraphs_layout);
$this->paragraph = $this
->newParagraph($paragraph_type);
$this->parentUuid = $parent_uuid;
$this->region = $region;
$this->siblingUuid = $sibling_uuid;
$this->placement = $placement;
if ($this->siblingUuid && $this->placement) {
$this->domSelector = '[data-uuid="' . $sibling_uuid . '"]';
$this->method = $placement;
}
elseif ($this->parentUuid && $this->region) {
$this->domSelector = '[data-region-uuid="' . $parent_uuid . '-' . $region . '"]';
}
else {
$this->domSelector = '[data-lpb-id="' . $this->layoutParagraphsLayout
->id() . '"]';
}
return $this
->buildComponentForm($form, $form_state);
}