Context Data

flack edited this page Dec 8, 2016 · 1 revision

Context data consists of component-specific data accessible through MidCOM in the following form:

midcom_core_context::get()->get_key(CONSTANT_NAME);

Optionally, you can supply a context id to get information from a different context than the current:

midcom_core_context::get($context_id)->get_key(CONSTANT_NAME);

Component Context Keys

  • MIDCOM_CONTEXT_ANCHORPREFIX: URL Anchor prefix relevant for dynamically loaded components, it includes a trailing slash and will give you the absolute URL to the requested URI of the system. (NOTE: This is not the URI to the component's topic, but the URI you would normally build relative URLs if your component was the primary one.)
  • MIDCOM_CONTEXT_SUBSTYLE: Currently selected substyle, usually extracted from a URL prefix.
  • MIDCOM_CONTEXT_ROOTTOPIC: The root topic object used to process this request.
  • MIDCOM_CONTEXT_CONTENTTOPIC: The Topic object displayed in this request.
  • MIDCOM_CONTEXT_COMPONENT: The name of the component handling this request.
  • MIDCOM_CONTEXT_OUTPUT: The HTML Data emitted by the component's run.
  • MIDCOM_CONTEXT_NAP: The MidCOM NAP Interface Class responsible for this context.
  • MIDCOM_CONTEXT_PAGETITLE: The Title of the current web page
  • MIDCOM_CONTEXT_LASTMODIFIED
  • MIDCOM_CONTEXT_PERMALINKGUID
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.