Copied to clipboard

Flag this post as spam?

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


  • Daniel Rogers 134 posts 712 karma points
    Aug 25, 2022 @ 03:55
    Daniel Rogers
    0

    Access current properties inside UmbracoAuthorizedJsonController

    I have a UmbracoAuthorizedJsonController that I are calling a function from a js code for a customized App_Plugin.

    This is an upgrade from a v8 umbraco App plugin to v 10.1.0

    I need to get the current page property .

    in version 8 my code was

    foreach (IDataType dataType1 in _dataTypeService.GetAll().Where<IDataType>((Func<IDataType, bool>)(x => x.EditorAlias == "IBD.PaperFlow.Plugin")))
                {
                    if (dataType1.Key.ToString() == dataTypeKey)
                    {
                        dataType = _dataTypeService.GetDataType(dataType1.Id);
                        break;
                    }
                }
    
    var propEditor = current.PropertyEditors.Where(x => x.Alias == dataType.EditorAlias).FirstOrDefault();
    

    I cannot find how I get the current property editors in version 10. The following line is the issue.

    var propEditor = current.PropertyEditors.Where(x => x.Alias == dataType.EditorAlias).FirstOrDefault();
    
  • Mario Lopez 168 posts 952 karma points MVP 3x c-trib
    Aug 27, 2022 @ 07:03
    Mario Lopez
    0

    Try this:

      int myId = 123;
      var paperFlowDataTypes = _dataTypeService.GetByEditorAlias("IBD.PaperFlow.Plugin");
      var myDataType = paperFlowDataTypes.FirstOrDefault(x => x.Id == myId);
      var propEditor = myDataType.Editor;
    
      // do your thing with the editor
    
  • Daniel Rogers 134 posts 712 karma points
    Sep 25, 2022 @ 14:07
    Daniel Rogers
    100

    Turns out what I was trying to achieve was really easy.

    I just needed to pass the value from the App_plugin $scope.model.config."value" to the controller and done.

Please Sign in or register to post replies

Write your reply to:

Draft