Jump to main content Jump to doc navigation

modX::toPlaceholder

Recursively validates and sets placeholders appropriate to the value type passed.

Syntax

API Doc: modX::toPlaceholder()

array toPlaceholder (string $key, mixed $value, [string $prefix = ''], [string $separator = '.'], [boolean $restore = false])

Example

Set a placeholder and prefix its key with 'my.' Returns an array multi-dimensional array containing up to two elements: 'keys' which always contains an array of placeholder keys that were set, and optionally, if the restore parameter is true, 'restore' containing an array of placeholder values that were overwritten by the method.

$modx->toPlaceholder('name','John','my');

See Also