function match_redirect_load_multiple in Match Redirect 7
Loads redirects and returns them ordered by weight.
Parameters
array $rids: Array of redirect ids to be loaded.
array $conditions: An associative array of conditions on the base table, where the keys are the database fields and the values are the values those fields must have. Instead, it is preferable to use EntityFieldQuery to retrieve a list of entity IDs loadable by this function.
bool $reset: Whether to reset the internal cache for the requested entity type.
Return value
array Returns loaded redirects array or empty array if none found.
3 calls to match_redirect_load_multiple()
- match_redirect_add_form_validate in ./
match_redirect.admin.inc - Validate callback for redirect add/edit form.
- match_redirect_init in ./
match_redirect.module - Implements hook_init().
- match_redirect_list_form in ./
match_redirect.admin.inc - Returns the redirect listing form that allows reordering of weights.
File
- ./
match_redirect.module, line 224 - Match redirect module.
Code
function match_redirect_load_multiple($rids = array(), array $conditions = array(), $reset = FALSE) {
// Order by weight.
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'match_redirect');
// Get only provided rids but exclude if $rids array is empty.
if (!empty($rids)) {
$query
->propertyCondition('rid', $rids, 'IN');
}
$query
->propertyOrderBy('weight');
$result = $query
->execute();
// Check for result and substitute reordered rids.
if (isset($result['match_redirect']) && !empty($result['match_redirect'])) {
$rids = array_keys($result['match_redirect']);
}
return entity_load('match_redirect', $rids, $conditions, $reset);
}