Copied to clipboard

Flag this post as spam?

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


  • pantryfight 60 posts 84 karma points
    Dec 16, 2015 @ 10:23
    pantryfight
    0

    Fetching value of another field from custom property editor

    Hi all,

    I'm currently writing a custom property editor and in it I want to try to fetch the value of another field in the doctype.

    I've been able to do this in a regular doctype (ie. a non-nested doctype) by doing this from my property editor's controller but obviously it doesn't work in Nested Content.

    var content = editorState.current;
    var properties = contentEditingHelper.getAllProps(content);
    
    var otherProperty = _.findWhere(properties, { alias: "otherPropertyAlias" });
    

    Is there a way I can do something like this from within Nested Content?

  • Ian 178 posts 752 karma points
    Dec 16, 2015 @ 18:49
    Ian
    0

    Strange, I've got an umbraco 7.2.6 site with a doctype which inherits from a master doctype with its own tab of properties and contentEditingHelper.getAllProps works just fine. getAllProps loops through each tab in the tabs property of the content argument (your editorState.current looks fine) and pushes each property into the returned array. What happens for you when debug and step into the getallprops function?

  • pantryfight 60 posts 84 karma points
    Dec 18, 2015 @ 02:03
    pantryfight
    0

    Maybe I need to clarify a bit here.. using my code sample above I was able to fetch properties from the page document type, but I couldn't work out how to get properties from the nested content document type.

    In the end however, I decided I was going about it all wrong. What I was trying to do from my property editor, was to fetch an image selected in another property editor (a media picker) and then perform actions on it in my property editor. (specifically, annotating the image with http://annotorious.github.io/)

    What I have done instead is use Umbraco's dialogService (http://umbraco.github.io/Belle/#/api/umbraco.services.dialogService) to bring up a media picker, and manage the image selection for my property editor instead. That way all of my logic is encapsulated within my property editor and I have no dependencies on other properties. Although my original query is unanswered, this works a lot better in my circumstance.

Please Sign in or register to post replies

Write your reply to:

Draft