Following Ajax Dialog Boxes, I wrote the following code:
public function buildForm(array $form, FormStateInterface $form_state) { $form['message'] = [ '#type' => 'textarea', '#prefix' => t('Message') .' <a class="use-ajax" data-dialog-options="{"width":400}" data-dialog-type="modal" href="/node/27" id="modal-dialog"><img src="/sites/default/files/images/info.svg"></a>', '#required' => TRUE, ]; $form['actions'] = [ '#type' => 'actions', ]; $form['actions']['submit'] = [ '#type' => 'submit', '#value' => $this->t('Send'), ]; return $form; }
When I click on the image ‘info.svg’ in the ‘Message’ field of the form, the content of the node 27 is displayed in a modal dialog box, as expected.
I would like now to "only" display some text and not the content of a node.
By what should I replace the href in my link?