Context for Getting Document Parent ID in Custom Property Editors (Block Grid Blocks)

I’m building a custom property editor that needs to fetch options from an API, but the options depend on the editor’s parent node in the content tree. The content structure looks roughly like this:

Container/
└── Subject1
    └── Series1
        └── Primary1
            ├── Secondary1
            ├── Secondary2
            └── Secondary3

So, for example:

  • Secondary1 should be aware of the ID of Primary1
  • Primary1 should know about Series1, and so on.

The challenge is: what’s the correct context or method to access this parent ID when the property editor lives inside a Block Grid block?

What I’ve Tried

  • Browsing available contexts using <umb-debug visible dialog></umb-debug> — helpful in some cases, but mostly inconclusive inside blocks.
  • Accessing UMB_DOCUMENT_WORKSPACE_CONTEXT — this sometimes provides useful data, but often doesn’t include the parent ID, even when the property editor is placed directly on a document.

Current Workaround (A Bit of a Somersault)

I’m starting to think that the browser URL is actually the most reliable place to extract the current document ID. It’s not exactly elegant—it feels like doing frontend somersaults just to grab something that should be one step away—but at least it’s consistent (I think?).

Is there a cleaner way?

Okay, so Retrieving ID/Unique of the current pages parent clarifies the issue with e.g. UMB_DOCUMENT_WORKSPACE_CONTEXT. I did not see this post until after I published mine.

However, it has now become more clear that my issues are:

  1. Getting parent node ID from unpublished content. The suggested workaround in the linked issue does not work for me in that case
  2. Getting parent node ID when property editor lives inside of a block grid block