protected function NodeStorageController::attachLoad

Overrides Drupal\Core\Entity\DatabaseStorageController::attachLoad().

Overrides DatabaseStorageController::attachLoad

File

drupal/core/modules/node/lib/Drupal/node/NodeStorageController.php, line 38
Definition of Drupal\node\NodeStorageController.

Class

NodeStorageController
Controller class for nodes.

Namespace

Drupal\node

Code

protected function attachLoad(&$nodes, $load_revision = 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) {

    // Retrieve the node type 'base' hook implementation based on a Node in
    // the type-specific stack.
    if ($function = node_hook($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, $load_revision);
}