-1

In some twig templates of the commerce modules, I can see the use of an alternate syntax:

Ex. in commerce-cart-flyout-offcanvas-contents-items.html.twig :

<% _.each(cart.order_items, function(orderItem, key) { %>

or

<%= orderItem.total_price.formatted %></td>

I can't see any doc on this and as I am curious, I would like to know from where it is coming and what is the difference.

1

In some twig templates of the commerce modules, I can see the use of an alternate syntax:

This is only in one module - Commerce Cart Flyout. These are Underscore.js templates. These are used to customize the JavaScript progressively decoupled cart flyout. These are not actually Twig templates.

It was a design decision I regret to try and enable end-users to customize Flyout without needing to learn how to override JavaScript.

  • 1
    If, with the help of this "design decision" we do not needs to handle Javascript when overriding is mandatory, then I will say it is a good idea!!! – Baud Jun 19 at 8:28
  • Yeah, this allows you to alter the Flyout templates without libraries-extend or anything. The Underscore.js contents are in Drupal's theme registry and more easily overridden. Would documentation somewhere have helped? In Flyout? Where did you find the template, our Belgrade theme maybe? or the module itself and I should add file doc comments – Matt Glaman Jun 19 at 12:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.