I have created a pull of images based upon a boolean field being checked. Now I would like to expand that conditional logic to also select from categories, using either a select list or a taxonomy list. Here is what I have:
function ycs_list() {
$query = new EntityFieldQuery;
$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', YCS_NODE_TYPE)
->propertyCondition('status', 1)
->fieldCondition('field_active_image', 'value', 1, '=');
$result = $query->execute();
return $result;
}
How can I expand this to use two fileds? If I were to use a taxonomy list, would I use something other than a EntityFieldQuery or is it just an additional condition of this?
You can add as many conditions to an
EntityFieldQueryas you like and as vocabularies are linked to nodes via fields in Drupal 7 you can include them quite easily. The only small thing to note is that the column name for a term ID in a term reference field istidinstead ofvaluewhich is used in a lot of cases.The following assumes your term reference field is named
field_my_term_field: