You can retrieve the current ContentEntityObject (ie the content object this macro is a part of), as follows:
1 2public String execute(Map parameters, String body, RenderContext renderContext) throws MacroException { // retrieve a reference to the body object this macro is in if (!(renderContext instanceof PageContext)) { throw new MacroException("This macro can only be used in a page"); } ContentEntityObject contentObject = ((PageContext)renderContext).getEntity(); ...
Note that this method might return null if there is no current content object (for example if you are previewing a page that has not been added yet, or if a remote user is rendering a fragment of notation).
Rate this page: