ECL Template Building Block

SDL Tridion 2013 comes with a new feature, External Content Library (ECL), which is a module for exposing multimedia contained in an external system in SDL Tridion so that you can use the media in SDL Tridion-driven Web sites.

Out of the box 2013 comes with a set of Template Building Blocks for ECL, however these assume that the published ECL content is directly available through the provider (i.e. the provider implements the GetDirectLinkToPublished method from the IContentLibraryMultimediaItem interface). While this will work for most providers, it is possible to have the GetDirectLinkToPublished method return null and implement the GetContent method from the IContentLibraryMultimediaItem interface instead. Here you would expose the content of your multimedia item expecting SDL Tridion to publish it like is done with regular Multimedia Components.

This eXtension is a Template Building Block (TBB) which can be used in your 2013 Modular Templates and will resolve ECL items, it comes as a replacement for the out of the box Search- & Resolve External Content Library items TBBs. This TBB scans through the output of your Dreamweaver TBB looking for images or links to ECL items. For every ECL item it checks if a direct link is available or if the content should be published by SDL Tridion and then it will use the Template Attributes (like width and height) to get the correct item. It also resolves ECL links in CSS using the url("ecl:uri") statement, similar to how you can use a TCMURI in there.

This TBB can be added in the Default Finish Actions as the first item, or be placed anywhere in your Component- or Page Templates as long as it comes after the DWT TBB and before the Publish Binaries in Package TBB. The Adjust SiteEdit 2012 markup for External Content Library items which comes with 2013 ECL still remains valuable to resolve XPM/SiteEdit markup for direct ECL links.

template builder

It is designed as an example to show how ECL items can be dealt with in TBBs and comes complete with all source code so you can see how it is all done. Feel free to take it apart completely or reuse as a basis for your own ECL TBBs. The source is available in the download package below and also on Google code as an open source project.

Installation

This eXtension comes with full source as a Microsoft Visual Studio solution which you can directly compile and deploy (you can use the free Microsoft Visual Studio Express edition). The project has a Post-build event (commented out) which can be used to call TcmUploadAssembly to build the TBB directly in your SDL Tridion CMS.

Background information

More information about ECL and how to create ECL providers can be found in the SDL Tridion documentation:

  1. Developing a Provider (ECL) (login required)
  2. External Content Library concepts and API (login required)
  3. ECL Event Handler
  4. Flickr ECL provider
  5. YouTube ECL provider

Developer
:    Bart Koopman
Company
License agreement
Download package
Tags
:    TBB,  2013,  ECL
Version
:   1.1
Source
:   Yes

About the Author
Bart Koopman
Community Development Consultant

As a Community Development Consultant, Bart is the evangelist of all SDL Tridion products. Bart used to be a consultant and trainer at SDL Tridion, supporting both partners and customers with their implementations.

SDL CMT division