Copied to clipboard

Flag this post as spam?

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


  • ThomasBrunbjerg 90 posts 182 karma points
    Aug 09, 2017 @ 13:16
    ThomasBrunbjerg
    0

    Altering existing property editors

    I'm new to Umbraco and I need to create a custom property editor, consisting of a mix between two already existing editors.

    What would be the best way to approach this? I've completed the property editor tutorial on the Umbraco site and I've downloaded a few projects that alter some property editors, but having a hard time understanding the code.

    Right now I am trying to add some functionality to the standard media picker editor, but I am unsure where to start.

    As i understand it, I need to get the media picker through the dialogService, but I've found no documentation anywhere for this.

  • Tobias Klika 101 posts 570 karma points c-trib
    Aug 09, 2017 @ 13:48
    Tobias Klika
    1

    In the Angular controller you can create the config object for built-in editors and use it with <umb-editor /> in the template.

    So for the media picker this would be in your template/view:

    <umb-editor model="mediaPicker" ng-if="mediaPicker"></umb-editor>

    And in your controller:

    $scope.mediaPicker = {
        view: 'mediapicker',
        value: null, // or your value
        config: { disableFolderSelect: true, onlyImages: true }
    };
    

    This defines that the editor should render and use the media-picker. Every editor has it's own options. Just look at the source code to find out how they are used. For media-picker you can find it here.

    Be sure that your view attaches your controller ;-)

    This is how you include the media picker property editor in another editor.

    If you want to extend a built-in property editor, just look at it's source code and copy/alter it. The link to the source code is above.

  • ThomasBrunbjerg 90 posts 182 karma points
    Sep 15, 2017 @ 06:46
    ThomasBrunbjerg
    0

    Hi, sorry for the late response. I can't get this to work. Nothing shows up in my backoffice. Are you sure I don't need to add anything else in HTML?

    I tried copy pasting the entire source code for the media picker and inserted it in my own custom property editor as well, but to no luck.

    I'm really not sure how to make this work, I can't find any posts or documentation on this.

Please Sign in or register to post replies

Write your reply to:

Draft