entity_load() uses FALSE as a second parameter to load all entities, as you can see here http://api.drupal.org/api/drupal/includes--common.inc/function/entity_lo.... media_load_multiple() uses an empty array as a default value, so it returns no media entities instead of all.

This patch changes the default value of the argument to FALSE.

CommentFileSizeAuthor
media_load_multiple.patch669 bytesjames.elliott

Comments

JacobSingh’s picture

Why do we want to load all? Is this manifesting as a bug somewhere? Seems preferable to load none if nothing is passed in.

-J

james.elliott’s picture

So this is a wrapper around entity_load() that reverses the argument-less behavior of entity_load() ?

JacobSingh’s picture

It's based on:

function node_load_multiple($nids = array(), $conditions = array(), $reset = FALSE) {
  return entity_load('node', $nids, $conditions, $reset);
}
james.elliott’s picture

Status: Needs review » Closed (won't fix)

I take back my concern in that case. I suppose it is much better to fail loading media by not throwing every media item back at you.

I've already removed the call to this function from the issue I was working on anyway.