1 node.entity.inc protected NodeStorageController::attachLoad(&$nodes, $revision_id = FALSE)

Overrides DefaultEntityController::attachLoad().

Parameters

Node[] $nodes: An array of nodes on which fields should be attached.

Overrides DefaultEntityController::attachLoad

File

core/modules/node/node.entity.inc, line 549
Entity controller and class for nodes.

Class

NodeStorageController
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);
}