Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alistair Graham 22 posts 62 karma points
    Feb 26, 2014 @ 16:26
    Alistair Graham
    0

    Umbraco Custom Media Types

    Umbraco Custom Media Types

    Using Umbraco v6.1.6

    I have created a Custom Upload File DataType called CustomUpload, the upload will be used instead of the default upload file control for media (File and Image).

    I have left the umbracoFile property on the media item and changed its DataType to my new CustomUpload. I have been able to create, edit and upload images and documents fine.

    I can select them in any type of controllers (DAMP etc). The exception to this is the WYSIWYG Editor, we can select images when inserting and image. But when we try to link to an image or document using the Insert a link button. All images and documents in the media tab are greyed out and not selectable.

    I have looked at the following, http://our.umbraco.org/wiki/how-tos/creating-custom-media-types

    http://our.umbraco.org/forum/developers/api-questions/17270-LinkableMediaDataTypes-for-RTE-Not-Working

    I have added the below to site, 

    public class pageEvents : ApplicationBase

    {

      public pageEvents()

      {

        //allow linking to PDF Flip Books in the HTML Editor Popup

        loadMedia test = new loadMedia("Media");

        loadMedia.LinkableMediaDataTypes.Add(new Guid("PUT THE GUID OF YOUR UPLOAD DATATYPE HERE"));

      }

    }

     

    But the values are still not selectable they are still greyed out.

    loadMedia requires a string parameter called application. Is this the section I am trying to add “Media” or is it the name of the custom property or the name of my application. 

    By default, any media type that is to be "linkable" in the WYSIWYG editor must contain a DataTypeUploadField data type which will ouput the value for the link, however, if a developer wants the WYSIWYG editor to link to a custom media type, they will either have to create their own media tree and inherit from this one and override the GetLinkValue or add another GUID to the LinkableMediaDataType list on application startup that matches the GUID of a custom data type. The order of property types on the media item definition will determine the output value.

    Anyone got any ideas?

    Thanks
    Ali
  • Alistair Graham 22 posts 62 karma points
    Mar 05, 2014 @ 10:44
    Alistair Graham
    0

    I ended up debuging the whole process. When I added the GUID to the list it wouldn't make a difference and still wouldn't work. I tried a number of different of ways to adding to the list at different steps and also adding it to the media items.

     

    In the end I changed my new upload control to have the GUID of the default upload control. As this GUID gets added to the list on startup in the umbraco.ddl. This then solved the issue, as we aren’t using the default upload control anywhere else it is fine but not an ideal way to do it.

Please Sign in or register to post replies

Write your reply to:

Draft