[MAGNOLIA-8849] Area context attributes not passed to component variants Created: 23/Mar/23  Updated: 06/Jun/23

Status: Open
Project: Magnolia
Component/s: freemarker, templating
Affects Version/s: 6.2.30
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Richard Gange Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Epic Link: AuthorX Support
Team: AuthorX

 Description   

Context attributes are not passed to component variants.

Consider an area which uses a custom template script:

areas:
  main:
    templateScript: /travel-demo/templates/pages/mainArea.ftl

In the script we pass contextAttributes to the component:

[#list components as component ]
  [@cms.component contextAttributes={"indexString":indexString, "useIndex":useIndex}/]
[/#list] 

When trying to access the context attributes in the component script they are lost when component variants are in place.

${ctx.indexString}
${ctx.useIndex}

Reproduce

  1. Create an area script which passes attributes.
  2. Configure the templateScript in the page template definition.
  3. Create a page with two components.
  4. Add a component variant to one of the components.

Actual
The component with variants cannot access the passed contextAttributes. The regular (non-variant) component can.

Expected
The contextAttributes should be accessible in the component variant.


Generated at Mon Feb 12 04:36:20 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.