Jump to main content Jump to doc navigation

modX::reloadContext

Without $key, it regenerates the current Context through modX::_initContext() and refreshes the + config placeholders. With $key, it loads that Context into modX::$contexts — even one that was never loaded — and does not switch to it.

Returns false when no Context is initialized and no key was given. The Resource Update processor calls it from cleanup() after a Resource was saved, unless the _reloadContext property is false.

Syntax

boolean reloadContext ([string $key = null])
  • $key (string) Context to (re)load; by default null reloads the current one

Example

$modx->reloadContext();      // refresh the Context in use
$modx->reloadContext('mgr'); // load another Context, stay where we are

See Also

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • Alex
  • A. Moreno
  • Chris Fickling
  • Stéphane Jäggi
  • Murray Wood
  • Anton Tarasov
  • JT Skaggs
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • YJ
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$194 per month—let's make that $500!

Learn more