public function EntityReferenceTreeController::openSearchForm in Entity Reference Tree Widget 2.x
Same name and namespace in other branches
- 8 src/Controller/EntityReferenceTreeController.php \Drupal\entity_reference_tree\Controller\EntityReferenceTreeController::openSearchForm()
Callback for opening the modal form.
1 string reference to 'EntityReferenceTreeController::openSearchForm'
File
- src/
Controller/ EntityReferenceTreeController.php, line 63
Class
- EntityReferenceTreeController
- EntityReferenceTreeController class.
Namespace
Drupal\entity_reference_tree\ControllerCode
public function openSearchForm(Request $request, string $field_edit_id, string $bundle, string $entity_type, string $theme, int $dots, string $dialog_title) {
$response = new AjaxResponse();
// Translate the title.
$dialog_title = $this
->t('@title', [
'@title' => $dialog_title,
]);
// Get the modal form using the form builder.
$modal_form = $this->formBuilder
->getForm('Drupal\\entity_reference_tree\\Form\\SearchForm', $field_edit_id, $bundle, $entity_type, $theme, $dots);
// Add an AJAX command to open a modal dialog with the form as the content.
$response
->addCommand(new OpenModalDialogCommand($dialog_title, $modal_form, [
'width' => '800',
]));
return $response;
}