public function LayoutParagraphsWidget::closeDialogAjax in Layout Paragraphs 1.0.x
Form submit handler - cancels item removal and closes confirmation form.
Parameters
array $form: The form array.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
\Drupal\Core\Ajax\AjaxResponse The Ajax Response.
File
- src/
Plugin/ Field/ FieldWidget/ LayoutParagraphsWidget.php, line 1965
Class
- LayoutParagraphsWidget
- Entity Reference with Layout field widget.
Namespace
Drupal\layout_paragraphs\Plugin\Field\FieldWidgetCode
public function closeDialogAjax(array $form, FormStateInterface $form_state) {
$element = $form_state
->getTriggeringElement();
$parents = $element['#element_parents'];
$field_state = static::getWidgetState($parents, $this->fieldName, $form_state);
$html_id = $this
->entityFormHtmlId($field_state);
$response = new AjaxResponse();
$response
->addCommand(new CloseDialogCommand('#' . $html_id));
return $response;
}