A modal form is defined in openModalForm(), and the modal form is called by $form['open_modal'].

public function openModalForm() {
  $response = new AjaxResponse();

  // Get the modal form using the form builder.
  $modal_form = $this->formBuilder->getForm('Drupal\workitemmanager\Form\WorkitemModalForm');

  // Add an AJAX command to open a modal dialog with the form as the content.
  $response->addCommand(new OpenModalDialogCommand('My Modal Form', $modal_form, ['width' => '800']));

  return $response;
$form['open_modal'] = [
  '#type' => 'link',
  '#title' => $this->t('Open Modal'),
  '#url' => Url::fromRoute('workitemmanager.open_modal_form'),
  '#attributes' => [
    'class' => [

The above will generate a modal form. So far, this has been confirmed. The following markup is rendered.


What I would like to do is the area highlighted in red below, the SUGGESTION is not shown, so the template cannot be applied.

Is there any way to change the markup rendered in this area?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.