Webform sometimes not sent on pages using different theme (via theme negotiator)

cn flag

I have a website with a main theme and another "mini" theme that is used via a custom module with a theme negotiator, determined by node type. The pages using the mini theme include a webform, in a block.

The mini theme pages seem to display properly, including the webform, but in many cases after filling the form, the submission is not sent (not logged in tables and no confirmation). There are several pages using this theme, in one it seems to happen inconsistently (sometimes the form is sent and sometimes not) and in all other cases it is consistent - sent only if I refresh the page (CTRL+F5), otherwise not sent.

Webforms in the main theme site are sent without any issues.

This problem started after upgrading to Drupal 9, and using Webform 6.1.0.

My code is below. Any help would be highly appreciated! Thank you :)

Theme code: This is the code used for the block, located in my theme file:

function minitheme_preprocess_page(&$variables) {  

  //form code
  $form_block_id = 'webform_8';

  $block = \Drupal\block\Entity\Block::load($form_block_id);
  $variables['short_contact'] = \Drupal::entityTypeManager()

And then added in the page.html.twig:

{{ short_contact }}

Module code: And this is the services file:

# Module services file


    class: Drupal\change_theme\Theme\ThemeNegotiator
      - { name: theme_negotiator, priority: 1000 }    

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.