You are here

function block_token_token_info in Block Token 8

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

Implements hook_token_info().

File

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

Code

function block_token_token_info() {
  $tokens = array();
  $blocks = block_token_blocks();
  foreach ($blocks as $token => $block) {
    $module = end($block
      ->getDependencies()['module']);
    $name = t('Block from module %module with id %delta', array(
      '%module' => $module,
      '%delta' => $block
        ->getOriginalId(),
    ));
    $tokens[$token] = array(
      'name' => $name,
      'description' => $name,
    );
  }
  return array(
    'types' => array(
      'block_token' => array(
        'name' => t("Block Token"),
        'description' => t("Tokens containing blocks."),
      ),
    ),
    'tokens' => array(
      'block_token' => $tokens,
    ),
  );
}