Copied to clipboard

Flag this post as spam?

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


  • Michaël Vanbrabandt 863 posts 3343 karma points c-trib
    Apr 07, 2018 @ 08:43
    Michaël Vanbrabandt
    0

    Extend existing Umbraco directive

    Hi community,

    is it possible to extend an existing Umbaco directive?

    The one I wish to extend is the umb-node-preview with an extra property called allow-preview and a property which will be executing a function called on-preview.

    Then finally also a new property called asignto which will be a user from the backoffice.

    Is this even possible? I don't want to complete create my own directive because 80% works with the existing umbraco umb-node-preview directive.

    Thanks in advance!

    /Michaël

  • Søren Gregersen 355 posts 1468 karma points MVP 2x c-trib
    Apr 07, 2018 @ 10:09
    Søren Gregersen
    0

    https://stackoverflow.com/questions/19987538/angularjs-extended-directive-controller

    That may be able to help you.

    Mind you, I haven't looked in to the specific directive to see if its build like that.

  • Michaël Vanbrabandt 863 posts 3343 karma points c-trib
    Apr 07, 2018 @ 11:08
    Michaël Vanbrabandt
    100

    Ok after searching in the source code, I found that this directive has another property called allow-open and a callback on-open so I used this.

    https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web.UI.Client/src/common/directives/components/umbnodepreview.directive.js

    For the asignto property I passed this through with the description property.

    /Michaël

  • Dave Woestenborghs 3325 posts 11170 karma points MVP 5x admin c-trib
    Apr 07, 2018 @ 14:04
    Dave Woestenborghs
    1

    I see you already tackled your issue.

    But maybe a good read anyways : http://skrift.io/articles/archive/changing-backoffice-functionality-without-changing-core-code/

    Dave

  • Michaël Vanbrabandt 863 posts 3343 karma points c-trib
    Apr 08, 2018 @ 06:47
    Michaël Vanbrabandt
    0

    Thanks Dave! Didn't know it was possible for also extending controllers so that you can use the core controller functions from Umbraco.

    /Michaël

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies