You are here

function _token_example_get_taxonomy_term in Examples for Developers 7

Builds a list of available taxonomy terms.

Related topics

File

token_example/token_example.module, line 205
An example module showing how to define and use tokens.

Code

function _token_example_get_taxonomy_term() {
  $term_query = db_select('taxonomy_term_data', 'ttd');
  $term_query
    ->fields('ttd', array(
    'tid',
    'name',
  ));
  $term_query
    ->range(0, 10);
  $term_query
    ->addTag('term_access');
  $terms = $term_query
    ->execute()
    ->fetchAllKeyed();
  $terms = array_map('check_plain', $terms);
  return $terms;
}