function aet_clear_tokens in Advanced Entity Tokens 7
Clears unreplaced tokens.
Parameters
array $tokens: The tokens array.
array $replacements: The replacements array
bool $clear: The clear flag is used to set if unreplaced tags should be cleared. defaults to TRUE.
2 calls to aet_clear_tokens()
- aet_tokens in ./
aet.tokens.inc - This is the main implementation of hook_tokens.
- _aet_entity_tokens in ./
aet.tokens.inc - INTERNAL implementation of hook_tokens specified for entities.
File
- ./
aet.module, line 28 - The AET main module file.
Code
function aet_clear_tokens($tokens, &$replacements, $clear = TRUE) {
// Checks if the clear option has been flagged.
if ($clear) {
// Loop threw all the tokens.
foreach ($tokens as $original) {
// Check if the token original value exists in the replacements array.
if (!isset($replacements[$original])) {
// Replace the token in the replacements array to an empty string.
$replacements[$original] = '';
}
}
}
}