You are here

function block_token_tokens in Block Token 7

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

Implements hook_tokens().

File

./block_token.module, line 144
The file contains Block Token module code.

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, $delta) = explode(BLOCK_TOKEN_SEPARATOR, $token, 2);
        $replacement = block_token_block_render($module, $delta);
      }
      $replacements[$original] = $replacement;
    }
  }
  return $replacements;
}