1
フロントエンドからリンクをクリックしたときにポップアップでカスタムフォームを表示したいのですが、Webで表示される多くのソリューションを試してみましたが、うまくいきません。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;
リンクをクリックしてこのフォームを開くにはどうすればよいですか。