I created a ECL for Brightcove. All the videos show up properly and you can browse through them. When I try to create a component with a link to an ECL item the preview shows up correctly. When I try to save the component, the title gets replaced with "The Item is not available" where the title should be and the thumbnail preview disappears. Has anyone experienced this type of error before?
1 Answer
Browsing and selecting an item use the methods GetItem
and GetFolderContent
in your provider, so they are probably working as expected.
When you save an item, Tridion will automatically load the item again and return it to the UI which is then updated. This has nothing to do with ECL, it is how Tridion ensures the new state of the item is correctly shown in the UI (typically changes to checked out state etc, but it can also be changes performed by an event system as the item is saved).
When a Tridion item with ECL items included is being loaded, the method GetItems
will be called on your provider. GetItems
is probably a bad name. We should have called it GetItemsReadTheDocumentationWhenImplementingThisOrYouWillGetItWrong
. :)
ECL pass every EclUri found on the TCM item being loaded to GetItems
(this does not imply GetItems
is not called in other cases, but your specific case is happening when it is called on TCM item load).
The provider is now required to load the items from the remote system, and return them to ECL. ECL will look at the returned items and match the EclUri of these items up with the EclUris of the items added to the Tridion item. If an EclUri is included on the Tridion item but is not returned from GetItems
ECL will conclude that the item is either deleted from the external system, or the current user does not have access to the item. ECL will then set the title to the text "The item is not available". It will obviously not try to get a thumbnail because - well - the item is not available. :)
So what you need to do is focus on the implementation of GetItems. You need to make sure the following is handled correctly (in your case, I expect the problem you see is in case 1, but the other ones are likely to be problematic as well):
- The ECL Items returned have the correct EclUri - meaning they must match the EclUri passed into
GetItems
100%. - BluePrinting is handled correctly. ECL is BluePrint aware, and it assumes the Provider is as well - meaning it will call
GetItems
requesting the exact same item across multiple Publications. It expects the provider to detect this and only get the item once from the remote system if this is most efficient, but always return one EclItem per requested Publication. While this makes implementing a provider more complex, it opens up for some functionality like for example mapping a publication in Tridion to an asset in a specific language. - The provider must not throw an exception from
GetItems
if the item does not exist on the remote system, or if the current user does not have access to the item. It should simply not return any data for the "missing" items. It is expected to throw an exception if there is a general error (network etc). In case your Provider can't determine if there is a general error or the item simply does not exist, always error on the side of not throwing an exception. If you throw an exception on an item that does not exist, deleting an item on the remote system can render any component in Tridion containing this ECL item impossible to open.
-
2GetItemsReadTheDocumentationWhenImplementingThisOrYouWillGetItWrong - LOL– Nuno Linhares ♦Dec 11, 2015 at 23:05