You are here

function _rotor_load in Rotor Banner 7

Same name and namespace in other branches
  1. 6.2 rotor.module \_rotor_load()
1 call to _rotor_load()
rotor_nodeapi in ./rotor.module

File

./rotor.module, line 211
A rotor banner consists in a set of images that will be changing. This module is made using jquery.

Code

function _rotor_load(&$node) {
  if (!$node->nid) {
    return;
  }
  $node->fid = FALSE;
  $rotor_item = db_fetch_object(db_query("SELECT * FROM {rotor_item} WHERE nid = %d", $node->nid));
  if ($rotor_item) {
    $node->fid = $rotor_item->fid ? db_fetch_object(db_query("SELECT * FROM {files} WHERE fid = %d", $rotor_item->fid)) : FALSE;
    foreach (array(
      'alt_text',
      'image_title',
      'url',
      'link_target',
    ) as $prop) {
      $node->{$prop} = $rotor_item->{$prop};
    }
  }
}