Copied to clipboard

Flag this post as spam?

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


  • David Amri 134 posts 537 karma points
    Oct 09, 2018 @ 13:52
    David Amri
    0

    Custom macro property editor

    Hi,

    I'm trying to create a custom property editor to be used inside of a macro.

    I would like the custom property editor to simply be a copy of the mutli media picker, but with a set start media folder. As I understand it, the only way to get a start folder is to create a custom editor with default start node value since the macro properties cant have pre-vaules.

    But after lots of reading and testing I'm still not able to get the property editor to work.

    According to this post I could copy the mediaPickerController function from the umbraco.controller.js from the Umbraco source and add the code to my controller.js.

    Then copy the html from mediapicker.html from the Umbraco source and paste to my controller.html.

    Then in my custom controller set "defaultConfig" to wanted start media folder.

    But I'm not able to render the media picker in the macro. Any help would be much appreciated.

    / Best regards

  • Marc Goodson 721 posts 4599 karma points MVP 3x c-trib
    Oct 09, 2018 @ 18:11
    Marc Goodson
    2

    Hi David

    Have a look at this package:

    https://our.umbraco.com/packages/developer-tools/parameter-editor-generator/

    It will generate the package.manifest file 'for you' from your chosen property editor, with your default config.

    Restart your Umbraco site, and you should have your new Macro Parameter!

    regards

    marc

  • David Amri 134 posts 537 karma points
    Oct 10, 2018 @ 06:03
    David Amri
    0

    Yupp, yupp. I was aware of this package. But I kind of hesitate when it comes to using packages... :/

    Do you know if there are any issues with this package when running on Umbraco 7.11? One of the reasons why I like to keep packages as minimal as possible is the somewhat absent support documentation regarding the packages.

    According to the package download page the support on 7.6 and 7.7 is awsome, the rest... who knows... :)

    Thanks for the help Marc! /David

  • Marc Goodson 721 posts 4599 karma points MVP 3x c-trib
    Oct 10, 2018 @ 19:17
    Marc Goodson
    100

    Hi David

    Yes you don't need to keep the package installed forever in your build. In fact you could install it in a seperate Umbraco site, and generate the package.manifest file for the configuration you need.

    What is important is the package.manifest file it would generate for your scenario is saved into the app_plugins folder of your site.

    When Umbarco starts up, it scans the app_plugins folder for package.manifest files, and adds them as options in the backoffice.

    All you need to do is 'handcraft' the package.manifest file, to pass in the defaultconfig options to the core property editor.

    https://our.umbraco.com/documentation/extending/property-editors/package-manifest

    You don't need to write a custom property editor.

    The cool thing about the tool is it will generate the manifest file for you.

    But you don't have to keep the package installed to make it work!

    So you could install the package on a totally different Umbraco site, use it to generate the package manifest, and copy the file to your actual site.

    If that make sense.

    regards

    marc

  • David Amri 134 posts 537 karma points
    Oct 16, 2018 @ 13:52
    David Amri
    0

    Hi again Marc,

    I tried the package but it's not quite working. I downloaded the package with nuget and created a custom editor like the docs said. I can choose the newly created editor in my macro but when trying the macro out in the rte the macro dialog is empty and has no property in it.

    I made a package of the repeatable textstring property editor with the minimum amount of 1 field but nothing shows up in the macro dialog.

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft