$modx->runSnippet(
'ddStringTools',
[
//This is an array, not string
'inputString' => [
'someObjectField' => '[+somePlaceholder+] need to be removed.',
//And this is an array too
'otherObjectField' => [
'deepField' => '[+placeholders+] will be removed in any depth.'
]
],
'tools' => [
'placeholderRemover' => true
]
]
);
//Include (MODX)EvolutionCMS.libraries.ddTools
/ddTools/modx.ddtools.class.php'
);
//Run (MODX)EvolutionCMS.snippets.ddStringTools
\DDTools\Snippet::runSnippet([
'name' => 'ddStringTools',
'params' => [
'inputString' => '<div class="someTrash"></div><p><b>Some</b> <a href="#">sample</a> <i>text</i>. [+somePlaceholder+]</p>.',
//`tools` in this case can be set as a native PHP array or object
'tools' => [
'placeholderRemover' => true,
'typographer' => true,
'tagRemover' => [
'allowed' => '<p><a>'
],
'caseConverter' => [
'toLower' => true
],
'charEscaper' => true
]
]
]);