function socbutt_tokens in Bootstrap Social Sharing Buttons 8
Same name and namespace in other branches
- 7 socbutt.module \socbutt_tokens()
Implements hook_tokens().
File
- ./
socbutt.module, line 45 - Allows integration with the Twitter microblogging service.
Code
function socbutt_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
$replacements = array();
if ($type == 'socbutt') {
foreach ($tokens as $name => $original) {
switch ($name) {
case 'vertical':
$replacements[$original] = \Drupal::service('renderer')
->render(_socbutt_buttons_render(array(
'layout' => SOCBUTT_LAYOUT_VERTICAL,
)));
break;
case 'horizontal':
$replacements[$original] = \Drupal::service('renderer')
->render(_socbutt_buttons_render(array(
'layout' => SOCBUTT_LAYOUT_HORIZONTAL,
)));
break;
}
}
}
return $replacements;
}