You are here

function themekey_comment_cid2nid in ThemeKey 7

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

ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).

src: comment:cid dst: node:nid

Parameters

$nid: a comment id

Return value

a node id or NULL if no value could be mapped

1 string reference to 'themekey_comment_cid2nid'
themekey_comment_themekey_properties in modules/themekey.comment.inc
Implements hook_themekey_properties().

File

modules/themekey.comment.inc, line 75
Provides some comment attributes as ThemeKey properties.

Code

function themekey_comment_cid2nid($cid) {
  $nid = db_select('comment', 'c')
    ->fields('c', array(
    'nid',
  ))
    ->condition('cid', $cid)
    ->execute()
    ->fetchField();
  return $nid ? $nid : NULL;
}