You are here

function themekey_node_themekey_properties in ThemeKey 6.3

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

Implements hook_themekey_properties().

Provides additional properties for module ThemeKey:

  • node:changed
  • node:created
  • node:changed_date_time
  • node:created_date_time
  • node:changed_date
  • node:created_date
  • node:language
  • node:nid
  • node:promote
  • node:sticky
  • node:type
  • node:uid
  • node:title

Return value

array of themekey properties and mapping functions

File

modules/themekey.node.inc, line 36
Provides some node attributes as ThemeKey properties.

Code

function themekey_node_themekey_properties() {

  // Attributes for properties
  $attributes = array();
  $attributes['node:changed'] = array(
    'description' => t('Node: Changed date - The date when the node was last edited/updated, formatted as unix timestamp like "1248873565".'),
    'validator' => 'themekey_validator_ctype_digit',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:created'] = array(
    'description' => t('Node: Created date - The date when the node was created, formatted as unix timestamp like "1248873565".'),
    'validator' => 'themekey_validator_ctype_digit',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:changed_date_time'] = array(
    'description' => t('Node: Changed date - The date including the time when the node was last edited/updated, formatted like "2009-12-24 18:13:24"'),
    'validator' => 'themekey_validator_date_time',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:created_date_time'] = array(
    'description' => t('Node: Created date - The date including the time when the node was created, formatted like "2009-12-24 18:13:24"'),
    'validator' => 'themekey_validator_date_time',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:changed_date'] = array(
    'description' => t('Node: Changed date - The date without the time when the node was last edited/updated, formatted like "2009-12-24"'),
    'validator' => 'themekey_validator_date',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:created_date'] = array(
    'description' => t('Node: Created date - The date without the time when the node was created, formatted like "2009-12-24"'),
    'validator' => 'themekey_validator_date',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:language'] = array(
    'description' => t('Node: Language - The code of the selected language of a node (formatted like "en" or "de") or "neutral". See !link for the codes of your enabled languages', array(
      '!link' => l(t('!path', array(
        '!path' => 'admin/settings/language',
      )), 'admin/settings/language'),
    )),
    'validator' => 'themekey_validator_language',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:nid'] = array(
    'description' => t('Node: ID - The id of a node (nid), can be found in the URL of the node, "node/23" or "node/23/edit" (23 = nid)'),
    'validator' => 'themekey_validator_ctype_digit',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:vid'] = array(
    'description' => t('Node: The version id of a node (vid), mostly for internal use within ThemeKey. In most cases it\'s better to use node:nid within your rule chains.'),
    'validator' => 'themekey_validator_ctype_digit',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:promote'] = array(
    'description' => t('Node: Promoted - If the node is promoted to the front page. Possible values are "0" for true and "1" for false.'),
    'validator' => 'themekey_validator_nummeric_boolean',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:sticky'] = array(
    'description' => t('Node: Sticky - If the node is set "Sticky at top of lists". Possible values are "0" for true and "1" for false.'),
    'validator' => 'themekey_validator_nummeric_boolean',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:type'] = array(
    'description' => t('Node: Type - The machine readable content type of the node. See !link for your content types (use column "Type"). Drupal default types are "page" and "story".', array(
      '!link' => l(t('!path', array(
        '!path' => 'admin/content/types',
      )), 'admin/content/types'),
    )),
    'validator' => 'themekey_validator_node_type',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:uid'] = array(
    'description' => t('Node: User ID - The node author\'s user id (uid). The user id can be found in the URL of the user\'s profile page, "user/23" or "user/23/edit" (23 = uid). See !link for your users.', array(
      '!link' => l(t('!path', array(
        '!path' => 'admin/user/user/list',
      )), 'admin/user/user/list'),
    )),
    'validator' => 'themekey_validator_ctype_digit',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );
  $attributes['node:title'] = array(
    'description' => t('Node: Title - The title of the node.'),
    'validator' => '',
    'page cache' => THEMEKEY_PAGECACHE_SUPPORTED,
  );

  // Mapping functions
  $maps = array();
  $maps[] = array(
    'src' => 'node:nid',
    'dst' => 'node:changed',
    'callback' => 'themekey_node_nid2changed',
  );
  $maps[] = array(
    'src' => 'node:nid',
    'dst' => 'node:created',
    'callback' => 'themekey_node_nid2created',
  );
  $maps[] = array(
    'src' => 'node:changed',
    'dst' => 'node:changed_date_time',
    'callback' => 'themekey_node_timestamp2datetime',
  );
  $maps[] = array(
    'src' => 'node:created',
    'dst' => 'node:created_date_time',
    'callback' => 'themekey_node_timestamp2datetime',
  );
  $maps[] = array(
    'src' => 'node:changed',
    'dst' => 'node:changed_date',
    'callback' => 'themekey_node_timestamp2date',
  );
  $maps[] = array(
    'src' => 'node:created',
    'dst' => 'node:created_date',
    'callback' => 'themekey_node_timestamp2date',
  );
  $maps[] = array(
    'src' => 'node:nid',
    'dst' => 'node:language',
    'callback' => 'themekey_node_nid2language',
  );
  $maps[] = array(
    'src' => 'node:nid',
    'dst' => 'node:vid',
    'callback' => 'themekey_node_nid2vid',
  );
  $maps[] = array(
    'src' => 'node:nid',
    'dst' => 'node:promote',
    'callback' => 'themekey_node_nid2promote',
  );
  $maps[] = array(
    'src' => 'node:nid',
    'dst' => 'node:sticky',
    'callback' => 'themekey_node_nid2sticky',
  );
  $maps[] = array(
    'src' => 'node:nid',
    'dst' => 'node:type',
    'callback' => 'themekey_node_nid2type',
  );
  $maps[] = array(
    'src' => 'node:nid',
    'dst' => 'node:uid',
    'callback' => 'themekey_node_nid2uid',
  );
  $maps[] = array(
    'src' => 'node:nid',
    'dst' => 'node:title',
    'callback' => 'themekey_node_nid2title',
  );
  $maps[] = array(
    'src' => 'drupal:get_q',
    'dst' => 'node:type',
    'callback' => 'themekey_node_get_q2type',
  );
  return array(
    'attributes' => $attributes,
    'maps' => $maps,
  );
}