Adding a new composite changes the theme hook and template.

Created on 1 December 2023, 7 months ago
Updated 2 December 2023, 7 months ago

Problem/Motivation

When I try to add a fieldset from the frontend using a webform composite, this and the previous fieldset miss a theme hook, and the default template gets used (table.html.twig). Before this action, there is a set of offered template names, and one of them I use: table--webform-my-form.html.twig.

Steps to reproduce:

  1. Add a composite consisted of 2-3 textfields.
  2. Check the suggested template name in <div class="webform-multiple-table webform-multiple-table-responsive"> using TWIG debug option.
    <!-- THEME DEBUG -->
    <!-- THEME HOOK: 'table__webform_my_form__vehicle_items' -->
    <!-- FILE NAME SUGGESTIONS:
       * table--webform-my_form--vehicle-items.html.twig
       * table--webform-my_form.html.twig
       x table.html.twig
    -->
    <!-- BEGIN OUTPUT from 'core/themes/stable9/templates/dataset/table.html.twig' -->
  3. Put the template with suggested filename (table--webform-my_form.html.twig) in templates folder. Change the template. Clear cache, reload form and go to the composite. The changes are applied and the new template is selected.
       * table--webform-my_form--vehicle-items.html.twig
       x table--webform-my_form.html.twig
       * table.html.twig
    
  4. Now click the Add button to add another fieldset and check Twig debug output. The default table template is used, and theme hook and suggestions are lost, as well as other hooks inside this div:
    <div id="composite_key_table">
    The changes are not applied. The debug output changes to the following:
    <!-- THEME DEBUG -->
    <!-- THEME HOOK: 'table' -->
    <!-- BEGIN OUTPUT from 'core/themes/stable9/templates/dataset/table.html.twig' -->
πŸ’¬ Support request
Status

Closed: outdated

Version

6.2

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain Stadoom

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024