You are here

function block_token_tokens in Block Token 8

Same name and namespace in other branches
  1. 7 block_token.module \block_token_tokens()

Implements hook_tokens().

File

./block_token.module, line 138
Defines necessary hooks and functions for block_token form.

Code

function block_token_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();
  if ('block_token' == $type) {
    foreach ($tokens as $token => $original) {
      $replacement = '';
      if (block_token_blocks($token)) {
        list($module, $id) = explode(BLOCK_TOKEN_SEPARATOR, $token, 2);
        $replacement = block_token_block_render($id);
      }
      $replacements[$original] = $replacement;
    }
  }
  return $replacements;
}