Score:0

How to change the position of status message for an embedded node?

cn flag

I have an embedded node that uses JavaScript.

I have added a message.

const messages = new Drupal.Message();
messages.add(
  Drupal.t('Please select option'),
  { type: 'error' }
);

The message is shown at the top of the page. How can i move the message to the top of the embedded node instead?

(embedded node is at the bottom of the original node)

Score:1
cn flag

I was unable to use status message block. I found out that i could change the position of message like this:

const messages =  new Drupal.Message(document.querySelector('#data-gallup-messages'))
messages.add(
    Drupal.t('Please select option'),
    { type: 'error' }
  );
}

and of-course the div i assign the message to needs to exist in twig.

<div id='data-gallup-messages'></div>
Score:0
cn flag

Drupal status messages are shown in the Status messages block. You can configure where that block is placed at /admin/structure/block.

The exact placement of the block depends on your theme's available regions.

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.