/** * @param \ElggEntity[] $entities * @return int[] */ protected function preloadCountsFromHook(array $entities) { $guids_not_loaded = array(); foreach ($entities as $entity) { // BC with likes_count(). If this hook is used this preloader may not be of much help. $type = $entity->getType(); $params = array('entity' => $entity); $num_likes = elgg_trigger_plugin_hook('likes:count', $type, $params, false); if ($num_likes) { $this->data->setNumLikes($entity->guid, $num_likes); } else { $guids_not_loaded[] = $entity->guid; } } return $guids_not_loaded; }