public function getEntitiesFromAttributes(array $options = array())
{
$defaults = array('attribute_name_value_pairs' => ELGG_ENTITIES_ANY_VALUE, 'attribute_name_value_pairs_operator' => 'AND');
$options = array_merge($defaults, $options);
$singulars = array('type', 'attribute_name_value_pair');
$options = _elgg_normalize_plural_options_array($options, $singulars);
$clauses = _elgg_get_entity_attribute_where_sql($options);
if ($clauses) {
// merge wheres to pass to elgg_get_entities()
if (isset($options['wheres']) && !is_array($options['wheres'])) {
$options['wheres'] = array($options['wheres']);
} elseif (!isset($options['wheres'])) {
$options['wheres'] = array();
}
$options['wheres'] = array_merge($options['wheres'], $clauses['wheres']);
// merge joins to pass to elgg_get_entities()
if (isset($options['joins']) && !is_array($options['joins'])) {
$options['joins'] = array($options['joins']);
} elseif (!isset($options['joins'])) {
$options['joins'] = array();
}
$options['joins'] = array_merge($options['joins'], $clauses['joins']);
}
return elgg_get_entities_from_relationship($options);
}