content_load

Versions
5 – 6
content_load(&$node)

Load data for a node type's fields. Implementation of hook_nodeapi 'load' op.

When loading one of the content.module nodes, we need to let each field handle its own loading. This can make for a number of queries in some cases, so we cache the loaded object structure and invalidate it during the update process.

▾ 1 function calls content_load()

mm_cck_node_file_delete in contributions/media_mover/mm_cck/mm_cck.module
Delete files associated with this configuration. @TODO should we delete the full node here?

Code

contributions/cck/content.module, line 238

<?php
function content_load(&$node) {
  $cid = 'content:'. $node->nid .':'. $node->vid;
  if ($cached = cache_get($cid, content_cache_tablename())) {
    foreach ($cached->data as $key => $value) {
      $node->$key = $value;
    }
  }
  else {
    $default_additions = _content_field_invoke_default('load', $node);
    if ($default_additions) {
      foreach ($default_additions as $key => $value) {
        $node->$key = $value;
      }
    }
    $additions = _content_field_invoke('load', $node);
    if ($additions) {
      foreach ($additions as $key => $value) {
        $node->$key = $value;
        $default_additions[$key] = $value;
      }
    }
    cache_set($cid, $default_additions, content_cache_tablename());
  }
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.