Jump to main content Jump to doc navigation

modChunk::process

Renders the Chunk and returns the output.

  1. modElement::process merges the given properties over the stored defaults and property sets, applies the input filter and loads the content.
  2. The parser walks the body for [[...]] tags; every property is available as a [[+key]] placeholder. The walk repeats up to parser_max_iterations times, 10 by default.
  3. The output filter runs.
  4. A cacheable Chunk's result enters the per-request element cache; a later call with the same tag reuses it.

Syntax

string process ([array|string $properties = null, string $content = null])
  • $properties (array|string) Merged over the Chunk's own properties and property sets before rendering, by default null.
  • $content (string) Replaces the stored Chunk content for this run; non-string values are ignored, by default null.
  • Declared in modChunk (core/src/Revolution/modChunk.php), overrides modElement::process (core/src/Revolution/modElement.php).

Example

$chunk = $modx->getObject('modChunk', ['name' => 'MyChunk']);
$chunk->setContent('<p>Hello, [[+name]]!</p>');
echo $chunk->process([
    'name' => 'staff',
]);

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