SDL Web 8.5 Retrieving ECL Items in TBB

 

 

SDL Web 8.5 - Retrieving ECL Items in TBB.

 

Background

As part of a client’s header navigation improvement, it was decided to

utilise SDL Web’s Taxonomy to render a three level tree structure to

represent the client’s navigation header. The same taxonomy hierarchy

can also be used to render the footer navigation.

 

It was decided that the taxonomy hierarchy were to be generated via

TBB and published as a JSON file to the content broker. This can then

be retrieved via DD4T’s PageFactory.FindPageContent(url) in the web

app, cached and then parsed to the relevant model.

 

There was a client requirement for accessing images in the content

manager via a third party service called Media Bin. This was achieved

using ECL (External Content Library) API and the content editors were

happy. The keyword metadata used for taxonomy included ECL items.

The following is how these values were retrieved.

 

Implementation

The TBB will involve recursively iterating two taxonomy hierarchies,

retrieve each keyword’s metadata content and populate a model

representing each field.

 

One field was an ECL Item representing the logo of the header. The

logo’s model was represented as such:

 

SDL Web 8.5 Retrieving ECL Items in TBB - Logo

 

The url , srcSetA and srcSetB were fully qualified url ready to be

rendered in the view. I created a helper class called EclHelper:

 
SDL Web 8.5 - Retrieving ECL Items in TBB -

 

 

 

To Use

 

SDL Web 8.5 Retrieving ECL Items in TBB - Usage

 

Improvements

I would have preferred if the helper wasn’t instantiated as such and

instead did something along the line of:

 

SDL Web 8.5 Retrieving ECL Items in TBB - Improvements

 

I hope that this helps anyone else who encounters something similar.

If you liked this article, you may find these resources interesting also:

 

 

Any questions?

If you need more information or have any questions just get in touch and we'd be happy to answer them for you.