You are here

function voting_rules_load_content in Voting Rules 6

Loads content of the specified type. Since Votingapi is built to support client defined content types, while Rules requires content types to be pre-defined, we use this helper function to encapsulate the loading of new content based on supported types (currently nodes, users, and comments)

Parameters

$content_type: String - e.g. node, user, comment

$content_id: Integer - e.g. nid, uid, cid

3 calls to voting_rules_load_content()
voting_rules_votingapi_delete in ./voting_rules.module
Implementation of hook_votingapi_results().
voting_rules_votingapi_insert in ./voting_rules.module
Implementation of hook_votingapi_insert().
voting_rules_votingapi_results in ./voting_rules.module
Implementation of hook_votingapi_results().

File

./voting_rules.module, line 113
Provides Rules intregration for the Votingapi module

Code

function voting_rules_load_content($content_type, $content_id) {
  switch ($content_type) {
    case 'node':
      return node_load($content_id);
      break;
    case 'user':
      return user_load($content_id);
      break;
    case 'comment':
      return _comment_load($content_id);
      break;
  }
}