Score:0

How to open a field value dynamically in a modal dialog on node view?

gu flag

I have a content type with a field, which contains HTML data (a short article).

When viewing a node, I want to have a link (or button, doesn't matter), which will open a modal dialog with the value of this field when clicked.

Content of the modal (fields value) has to be loaded dynamically. In other words, the content of the modal should be loaded in DOM only when (and if) the link is clicked.

This is the simple realization of a modal to open URL:

<a class="use-ajax" data-dialog-type="modal" href="/url">anchor</a>

What do I need to do, to load my field dynamically in a modal?

4uk4 avatar
cn flag
You could create a route to show the node with a custom display/view mode. See https://drupal.stackexchange.com/questions/206826/create-a-route-to-show-a-node-with-a-custom-display-view-mode
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.