function redhen_org_tokens in RedHen CRM 8
Implements hook_tokens().
File
- modules/
redhen_org/ redhen_org.module, line 91 - Contains redhen_org.module..
Code
function redhen_org_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
$replacements = [];
if ($type == 'entity' && isset($data['entity_type']) && $data['entity_type'] == 'redhen_org') {
foreach ($tokens as $name => $original) {
switch ($name) {
case 'id':
$replacements[$original] = $data['entity']
->id();
break;
case 'name':
$replacements[$original] = $data['entity']
->getName();
break;
case 'type':
$replacements[$original] = $data['entity']
->getType();
break;
case 'status':
$replacements[$original] = $data['entity']
->isActive();
break;
case 'created':
$replacements[$original] = $data['entity']
->getCreatedTime();
break;
}
}
}
return $replacements;
}