You are here

function instagram_feeds_tokens in Instagram Feeds 8

Implements hook_tokens().

File

./instagram_feeds.tokens.inc, line 78
Provides Token integration for Instagram Feeds.

Code

function instagram_feeds_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
  $replacements = [];
  $token_service = \Drupal::token();
  if ('instagram-account' == $type && !empty($data['instagram_account']) && $data['instagram_account'] instanceof InstagramAccountInterface) {
    $replacements += _instagram_feeds_account_tokens($token_service, $tokens, $data['instagram_account'], $options, $bubbleable_metadata);
  }
  if ('instagram-post' == $type && !empty($data['instagram_post'])) {
    $replacements += _instagram_feeds_post_tokens($token_service, $tokens, $data['instagram_post'], $options, $bubbleable_metadata);
  }
  return $replacements;
}