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 change_theme.services.yml


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.