You are here

public function NodeGalleryBehaviorHandler::load in Node Gallery 7

Act on loading entity reference fields of entities.

Overrides EntityReference_BehaviorHandler_Abstract::load

See also

hook_field_load()

File

plugins/entityreference/behavior/NodeGalleryBehaviorHandler.class.php, line 17
Node Gallery EntityReference behavior plugin.

Class

NodeGalleryBehaviorHandler
Node Gallery behavior handler.

Code

public function load($entity_type, $entities, $field, $instances, $langcode, &$items) {

  // Get the Node galleries.
  foreach ($entities as $entity) {
    $relationships = node_gallery_api_get_relationships(NULL, $entity->nid);
    foreach ($relationships as $relationship) {
      $items[$entity->nid][] = array(
        'target_id' => $relationship->ngid,
      );
    }
  }
}