You are here

function themekey_taxonomy_themekey_properties in ThemeKey 7.3

Same name and namespace in other branches
  1. 6.4 modules/themekey.taxonomy.inc \themekey_taxonomy_themekey_properties()
  2. 6 modules/themekey.taxonomy.inc \themekey_taxonomy_themekey_properties()
  3. 6.2 modules/themekey.taxonomy.inc \themekey_taxonomy_themekey_properties()
  4. 6.3 modules/themekey.taxonomy.inc \themekey_taxonomy_themekey_properties()
  5. 7 modules/themekey.taxonomy.inc \themekey_taxonomy_themekey_properties()
  6. 7.2 modules/themekey.taxonomy.inc \themekey_taxonomy_themekey_properties()

Implements hook_themekey_properties().

Provides additional properties for the Themekey module:

  • taxonomy:vid
  • taxonomy:tid
  • taxonomy:tid_and_childs

Return value

array of themekey properties and mapping functions

File

modules/themekey.taxonomy.inc, line 26
Provides some taxonomy stuff as ThemeKey properties.

Code

function themekey_taxonomy_themekey_properties() {

  // Attributes for properties ;)
  $attributes = array();
  $attributes['taxonomy:vid'] = array(
    'description' => t('Taxonomy: Vocabulary - The vocabulary id (vid) of a taxonomy vocabulary. See !link for your vocabularies.', array(
      '!link' => l(t('!path', array(
        '!path' => 'admin/structure/taxonomy',
      )), 'admin/structure/taxonomy'),
    )),
    'validator' => 'themekey_validator_ctype_digit',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['taxonomy:tid'] = array(
    'description' => t('Taxonomy: Term - The term id (tid) of a taxonomy term.'),
    'validator' => 'themekey_validator_ctype_digit',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['taxonomy:tid_and_childs'] = array(
    'description' => t('Taxonomy: Term and its childs - The term id (tid) of a taxonomy term. If set, all child terms of this term will be used too.'),
    'validator' => 'themekey_validator_ctype_digit',
    'page cache' => THEMEKEY_PAGECACHE_UNSUPPORTED,
  );
  $attributes['taxonomy:name'] = array(
    'description' => t('Taxonomy: Name - The term name (name) of a taxonomy term without support for translations.'),
    'validator' => '',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );

  // Mapping functions
  $maps = array();
  $maps[] = array(
    'src' => 'taxonomy:tid',
    'dst' => 'taxonomy:vid',
    'callback' => 'themekey_taxonomy_tid2vid',
  );
  $maps[] = array(
    'src' => 'taxonomy:tid',
    'dst' => 'taxonomy:tid_and_childs',
    'callback' => 'themekey_taxonomy_tid2tid_and_parents',
  );
  $maps[] = array(
    'src' => 'node:nid',
    'dst' => 'taxonomy:tid',
    'callback' => 'themekey_taxonomy_nid2tid',
  );
  $maps[] = array(
    'src' => 'taxonomy:tid',
    'dst' => 'taxonomy:name',
    'callback' => 'themekey_taxonomy_tid2name',
  );
  return array(
    'attributes' => $attributes,
    'maps' => $maps,
  );
}