Has anyone got an example of how to add something to the LinkableMediaDataTypes of the loadMedia object, so that I can link to a custom media item?
I've looked through the source and according to the comments, I can either override the media tree (which I'd ideally like to avoid), or use the LinkableMediaDataTypes collection to add new guids for datatypes that should be allowed in the RTE link dialog.
So I have the following code in an ApplicationBase class that registers a bunch of event listeners etc for for my site:
//allow linking to PDF Flip Books in the HTML Editor Popup loadMedia.LinkableMediaDataTypes.Add(new Guid("4e12da74-11e2-458d-9b7e-2847ed30b1bb"));
However, the RTE link dialog still shows up the link as having no link (ie there's no file link like there are with images/files). All the other handlers are working OK, it's just this that's not being picked up. Am I assigning to the list in the wrong place?
I'm not sure what's going on, any pointers or advice from folks who've done similar would be greatly appreciated!
Hmmmmmmm, for some reason, the code isn't picked up in the class that inherits from ApplicationBase. If I put the code somewhere else however (like inthe code behind on a dashboard) then it picks it up correctly. I know for a fact the ApplicationBase code is running, as all the events on the content tree are running correctly. Interestingly, if I try and write out the count of the items in the loadMedia.LinkableMediaDataTypes collection on the default dashboard, it craps out with a null reference error. If I visit the media section and then go back to the dasboard, it lists the number of items in the collection, so presumably its only instantiated on first use? Is there somewhere else I should be assigning to the collection rather than in an ApplicationBase class?
Got it to work. You need to instantiate an instance of the loadMedia class first before you can assign to the list (instantiating the class fires the constructor that creates and populates the list). By changing my code in the ApplicationBase class to the following:
loadMedia test = new loadMedia("Mediearkiv"); loadMedia.LinkableMediaDataTypes.Add(new Guid("4e12da74-11e2-458d-9b7e-2847ed30b1bb"));
I was able to get it to work correctly. I'm going to add instructions for this to the Wiki, in case anyone else ever needs to do it.
LinkableMediaDataTypes for RTE Not Working
Has anyone got an example of how to add something to the LinkableMediaDataTypes of the loadMedia object, so that I can link to a custom media item?
I've looked through the source and according to the comments, I can either override the media tree (which I'd ideally like to avoid), or use the LinkableMediaDataTypes collection to add new guids for datatypes that should be allowed in the RTE link dialog.
So I have the following code in an ApplicationBase class that registers a bunch of event listeners etc for for my site:
//allow linking to PDF Flip Books in the HTML Editor Popup
loadMedia.LinkableMediaDataTypes.Add(new Guid("4e12da74-11e2-458d-9b7e-2847ed30b1bb"));
However, the RTE link dialog still shows up the link as having no link (ie there's no file link like there are with images/files). All the other handlers are working OK, it's just this that's not being picked up. Am I assigning to the list in the wrong place?
I'm not sure what's going on, any pointers or advice from folks who've done similar would be greatly appreciated!
:)
Tim.
Hmmmmmmm, for some reason, the code isn't picked up in the class that inherits from ApplicationBase. If I put the code somewhere else however (like inthe code behind on a dashboard) then it picks it up correctly. I know for a fact the ApplicationBase code is running, as all the events on the content tree are running correctly. Interestingly, if I try and write out the count of the items in the loadMedia.LinkableMediaDataTypes collection on the default dashboard, it craps out with a null reference error. If I visit the media section and then go back to the dasboard, it lists the number of items in the collection, so presumably its only instantiated on first use? Is there somewhere else I should be assigning to the collection rather than in an ApplicationBase class?
Got it to work. You need to instantiate an instance of the loadMedia class first before you can assign to the list (instantiating the class fires the constructor that creates and populates the list). By changing my code in the ApplicationBase class to the following:
loadMedia test = new loadMedia("Mediearkiv");
loadMedia.LinkableMediaDataTypes.Add(new Guid("4e12da74-11e2-458d-9b7e-2847ed30b1bb"));
I was able to get it to work correctly. I'm going to add instructions for this to the Wiki, in case anyone else ever needs to do it.
is working on a reply...