You are here

function node_get_statistics_field_value in Better Statistics 7

Returns the stats field value for a given field.

Parameters

string $field: The name of the field for which a value should be returned.

Return value

mixed The value of the stats field specified, or NULL if none could be found.

See also

node_better_statistics_fields()

1 string reference to 'node_get_statistics_field_value'
node_better_statistics_fields in modules/node.statistics.inc
Implements hook_better_statistics_fields().

File

modules/node.statistics.inc, line 184
Statistics API functions and hooks for the Node module.

Code

function node_get_statistics_field_value($field) {
  $node = function_exists('menu_get_object') ? menu_get_object('node') : NULL;
  switch ($field) {
    case 'node_id':
      return isset($node->nid) ? $node->nid : NULL;
      break;
    case 'node_vid':
      return isset($node->vid) ? $node->vid : NULL;
      break;
    case 'node_tnid':
      return isset($node->tnid) ? $node->tnid : NULL;
      break;
    case 'node_type':
      return isset($node->type) ? $node->type : NULL;
      break;
    case 'node_uid':
      return isset($node->uid) ? $node->uid : NULL;
      break;
  }
  return NULL;
}