RWS / dxa-content-management

SDL Digital Experience Accelerator CM-side framework (.NET Template Building Blocks)
Apache License 2.0
6 stars 18 forks source link

Component Template TBB parameters ignored in Page rendering #38

Open willprice76 opened 5 years ago

willprice76 commented 5 years ago

We want to vary DXA TBB parameters such as the expandLinkDepth on a Component Template by Component Template basis, however if we set these TBB parameters on Component Template level, they are ignored when a Page is rendered - only TBB parameters set on Page Template level are picked up (but this obviously doesn't give the flexibility to alter the parameters per template). Is this a bug? I guess this might work as required if the DXA Custom Resolver were used and we published everything as Data Presentations, but it would be nice if it also worked without it.

rpannekoek commented 5 years ago

This is not a bug. When building a DXA R2 Page Model, the parameters on "Generate R2 Page Model" TBB are used. When building a DXA R2 Entity Model for a DCP, the parameters on "Generate R2 Entity Model" TBB are used. Indeed, it may be more flexible if embedded Entity Models can be configured separately, but that is currently not the case. Valid Enhancement Request, though.

willprice76 commented 5 years ago

As far as I can remember DD4T does take the expandLinkDepth from the CT (its called LinkLevels in DD4T) rather than the PT, so you could say that this is a bug introduced in DXA 2.0 with the new templates...

willprice76 commented 5 years ago

The link level is passed from the PT when building the CP: https://github.com/dd4t/DD4T.TridionTemplates/blob/a471e2c98512c52ed2e246df40be4cb17c8e4881/source/DD4T.Templates.Base/Builder/PageBuilder.cs#L50 But then ignored (which means it must come from the CT) https://github.com/dd4t/DD4T.TridionTemplates/blob/a471e2c98512c52ed2e246df40be4cb17c8e4881/source/DD4T.Templates.Base/Builder/BuildManager.cs#L69