1
我想在弹出窗口中显示我的自定义窗体,当用户点击前端链接时,我尝试了很多在网络中显示但不适用于我的解决方案。Drupal 8自定义窗体弹出
这是我的代码。
$response = new AjaxResponse();
// Get the modal form using the form builder.
$modal_form = $this->formBuilder->getForm('Drupal\fwsactions\Forms\FwsActionsForm');
$modal_form['#attached']['library'][] = 'core/drupal.dialog.ajax';
// Add an AJAX command to open a modal dialog with the form as the content.
$modal_form = render($modal_form);
$response->addCommand(new OpenModalDialogCommand('My Modal Form', $modal_form, ['width' => '800']));
return $response;
我该怎么做,只需点击一个链接即可打开此表单。