Adding RelatedMediaField to Custom Module - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Adding RelatedMediaField to Custom Module

  • Adding RelatedMediaField to Custom Module
  • I am trying to add a RelatedMediaField to the detail control, and unable to determine how I should be getting a script reference to the control.

    If this was a widget designer there would be some changes to "GetScriptDescriptors" and the js file to wireup the control references, but the simpleview control for the custom module does not have that function.

    I wasn't able to find any kind of on init function I could tap into like the HtmlField control has, so I don't know how to wire it in.

     

  • Hello Michael,

    You can use SimpleScriptView instead of SimpleView to inherit from. SimpleScriptView implements IScriptControl interface which will give you access to GetScriptDescriptors and GetScriptReferences methods to wire up client side logic.

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • that is what I was looking for, and based on sample code I have for widget designers I can take it the rest of the way.

    My remaining question is where is this documented? I suspect I missed it, but it seems the correct way to make a complete custom module is missing steps in the documentation.

  • Hello Michael,

    We have an article that mentions the 2 base classes which you can inherit from when creating your own controls:

    http://docs.sitefinity.com/for-developers-create-a-new-custom-widget

    Sample implementation on SimpleScriptView:

    http://docs.sitefinity.com/image-selector-for-content-items-implement-the-server-widget

    Looking at those however I can see where the confusion comes from, so I have placed a Documentation enhancement request, so that we can provide a bit more information on those 2 classes in the first article as well as links to the different samples of their implementation, so that it can be found easier.

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • Are there samples that cover how to take the thunder created simple view script file to work with a simplescriptview?

  • 0c8d1328-677d-413b-be57-e8d8129e239e_SimpleScriptControl.zip
    Hello Michael,

    Thunder uses SimpleView as a base class for the controls it generates and for now there is no option to switch it to use SimpleScriptView.

    When you generate the control, just manually change that base SimpleView to SimpleScriptView and implement the required GetScriptDescriptors and GetScriptReferences methods

    I have attached a simple control implementing SimpleScriptView which you can check.

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items