Score:0

Can you not have "computed twig" type in custom composite?

ph flag

I have a field in my custom composite element for qty, unit price, and total. For the field "total", I want this to display the multiply of qty and unit price. However, since there is no computed twig for type I manually added this in YML source:

total:
  '#type': computed_twig
  '#title': Total
  '#template': '{{ (data.qty * data.unit_price) }}'

I still get "- Select type-" for the type of total field, and it doesn't display anything when I test the form. Is computed twig type not supported in custom composite?

beltouche avatar
cn flag
Unfortunately, it appears not. See https://www.drupal.org/project/webform/issues/3220654 I'm trying to do something similar. If I come up with a solution, I'll post it here.
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.