function NodeController::attachLoad

Overrides DrupalDefaultEntityController::attachLoad

File

modules/node/node.module, line 4159

Class

NodeController
Controller class for nodes.

Code

protected function attachLoad(&$nodes, $revision_id = FALSE) {
    // Create an array of nodes for each content type and pass this to the
    // object type specific callback.
    $typed_nodes = array();
    foreach ($nodes as $id => $entity) {
        $typed_nodes[$entity->type][$id] = $entity;
    }
    // Call object type specific callbacks on each typed array of nodes.
    foreach ($typed_nodes as $node_type => $nodes_of_type) {
        if (node_hook($node_type, 'load')) {
            $function = node_type_get_base($node_type) . '_load';
            $function($nodes_of_type);
        }
    }
    // Besides the list of nodes, pass one additional argument to
    // hook_node_load(), containing a list of node types that were loaded.
    $argument = array_keys($typed_nodes);
    $this->hookLoadArguments = array(
        $argument,
    );
    parent::attachLoad($nodes, $revision_id);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.