Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function CommentController::attachLoad

Attaches data to entities upon loading.

This will attach fields, if the entity is fieldable. It calls hook_entity_load() for modules which need to add data to all entities. It also calls hook_TYPE_load() on the loaded entities. For example hook_node_load() or hook_user_load(). If your hook_TYPE_load() expects special parameters apart from the queried entities, you can set $this->hookLoadArguments prior to calling the method. See NodeController::attachLoad() for an example.

Parameters

$queried_entities: Associative array of query results, keyed on the entity ID.

$revision_id: ID of the revision that was loaded, or FALSE if the most current revision was loaded.

Overrides DrupalDefaultEntityController::attachLoad

File

modules/comment/comment.module, line 1722

Class

CommentController
Controller class for comments.

Code

protected function attachLoad(&$comments, $revision_id = FALSE) {
 // Setup standard comment properties.
 foreach ($comments as $key => $comment) {
 $comment->name  = $comment->uid ? $comment->registered_name : $comment->name ;
 $comment->new  = node_mark ($comment->nid, $comment->changed );
 $comment->node_type  = 'comment_node_' . $comment->node_type ;
 $comments[$key] = $comment;
 }
 parent ::attachLoad ($comments, $revision_id);
}

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