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 214 posts 740 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 2157 posts 14431 karma points MVP 9x 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 214 posts 740 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 2157 posts 14431 karma points MVP 9x 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 214 posts 740 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

  • Nathan Skidmore 63 posts 251 karma points c-trib
    Jan 30, 2019 @ 12:11
    Nathan Skidmore
    1

    Hi David. The package doesn't always work for all data types unfortunately. You will need to manually modify the package.manifest file.

    If for example you want to use a dropdown in a macro, it won't work by default using the Parameter Editor Generator package. The reason is because the default config is not populated correctly. You will have to make some changes to the file manifest file to provide the correct defaultConfig.

    E.g. the standard dropdown property editor requires a Dictionary of Items like this:

    "defaultConfig": {
                "items": [
                    {
                        "id": "position-center",
                        "value": "Center"
                    },
                    {
                        "id": "position-left",
                        "value": "Left"
                    },
                    {
                        "id": "position-right",
                        "value": "Right"
                    }
                ]
            },
    

    For the multi media picker you would have to check the media picker property editor template to see what object is is expecting.

    Hope this helps.

  • Jeroen Oostwouder 104 posts 300 karma points
    Mar 12, 2019 @ 07:20
    Jeroen Oostwouder
    0

    I just tried this package in 7.13.2, and it doesn't even show the Generate option on datatypes (tried multiple, including custom-made datatypes).

    I just want to be able to place a label on the macro properties panel. A simple helptext for the user. :(

Please Sign in or register to post replies

Write your reply to:

Draft