Score:0

How to change markup of modal dialogs

zm flag

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' => [
      'use-ajax',
      'button',
    ],
  ],
];

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

screenshot

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?

berliner avatar
bd flag
Possible duplicate of https://drupal.stackexchange.com/questions/293061/how-do-i-theme-the-core-modal-with-twig
shibasaki_stack avatar
zm flag
Thanks,I can't find this. I will check it.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.