1 token_example.module _token_example_get_taxonomy_term()

Builds a list of available taxonomy terms.

Related topics

File

modules/examples/token_example/token_example.module, line 197
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;
}