Use Embeddables in a custom content type

I have a custom IContentType and want to be able to use embeddables within it.  What do I need to do to enable my custom content type to use embeddables?

Parents
  • You'll want to implement IContentEmbeddableContentType, which provides a reference to IContentEmbeddableContentTypeController to call Updated when content that may contain embeddables is created or updated. (Also Deleted for when it is deleted). The basic setup is similar to that shown in the IFileEmbeddable training, though the method signatures and usages obviously differ.

  • I have this wokring on the backend...but in order for the embeddable to render do I need to run my HTML content through some sort of rendering engine?   

  • It appears I'm getting this exception when calling the update method:

    UnknownException: An error occurred while rendering the 'save.vm' script from the 'FCC - Lesson Edit' widget (56dbcbb8-e06d-48d0-8af1-0def3dc81a4a). (An error occurred while trying to render a widget. Details of the issue were logged for review by the administrator.) ---> NVelocity.Exception.MethodInvocationException: Invocation of method 'Update' in  HearingFirst.LearningExperience.Widget.LessonExtension+LessonExtensionObject threw exception System.InvalidCastException : Object must implement IConvertible. ---> System.InvalidCastException: Object must implement IConvertible.
       at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
       at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType, Boolean& coercedToDataFeed, Boolean& typeChanged, Boolean allowStreaming)
       --- End of inner exception stack trace ---
       at NVelocity.Runtime.Parser.Node.ASTMethod.Execute(Object o, IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTReference.Execute(Object o, IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTSetDirective.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.ASTBlock.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.SimpleNode.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.ASTIfStatement.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.SimpleNode.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Template.Merge(IContext context, TextWriter writer)
       at Telligent.Evolution.Platform.Scripting.Implementations.ScriptedExtensionExecutionService.<>c__DisplayClass28_1.<ExecuteScriptFile>b__0()
       at Telligent.Evolution.Platform.Scripting.Implementations.ScriptedExtensionOutputCachingService.Get(ScriptedExtension extension, String cacheKey, Boolean cacheable, Func`1 getRenderedOutput)
       at Telligent.Evolution.Platform.Scripting.Implementations.ScriptedExtensionExecutionService.ExecuteScriptFile(ScriptedExtension extension, ScriptedFileType fileType, String fileName, ScriptExecutionExceptionHandling exceptionHandling)
       --- End of inner exception stack trace ---
       at Telligent.Evolution.Platform.Scripting.Implementations.ScriptedExtensionExecutionService.HandleExecutionException(Exception ex, ScriptExecutionExceptionHandling exceptionHandling, ScriptedExtension extension, String scriptName, IRenderedScript& renderedScript)
       at Telligent.Evolution.Platform.Scripting.Implementations.ScriptedExtensionExecutionService.ExecuteScriptFile(ScriptedExtension extension, ScriptedFileType fileType, String fileName, ScriptExecutionExceptionHandling exceptionHandling)
       at Telligent.Evolution.Platform.Scripting.Implementations.ScriptedExtensionFileExecutionService.ExecuteInternal(ScriptedExtension scriptedExtension, ScriptedFileType fileType, String fileName, NameValueCollection parameters, TextWriter writer)
       at Telligent.Evolution.Platform.Scripting.Implementations.ScriptedExtensionFileExecutionService.HandleRequest()
  • if (_embeddedController != null)
    {
        _embeddedController.Updated(e.Lesson.ContentId, e.Lesson.ContentTypeId, (updater) =>
        {
            e.Lesson.Description = updater.Update(e.Lesson.Description);
        });
    }

Reply Children