0
私は国のタクソノミー用語参照フィールドを持つMap Pointsというエンティティバンドルを持っています。カスタムモジュールでEntityFieldQueryを使用してすべてのマップポイントエンティティを一覧表示していますが、国の参照フィールドでグループ化する必要があります。Drupal EntityFieldQueryグループ結果タクソノミー
ここでは、私は現在tid 1でクエリをフィルタリングしているコードがあります。結果をグループ化するために各国のクエリを繰り返すことができますが、結果をグループ化するより洗練された方法を探しています。各国の新しいクエリを記述することなく、国の用語IDを使用できます。
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'givepower')
->entityCondition('bundle', 'map_points')
->propertyCondition('type', 'map_points', '=')
->fieldCondition('field_map_point_country', 'tid', '1');
$result = $query->execute();
// set empty map point id array
$map_point_ids = array();
// loop through all givepower entities
foreach($result['givepower'] as $record) {
$map_point_ids[] = $record->id;
}
// load entities
$map_point = entity_load('givepower', $map_point_ids);
// set entity view
$entities = entity_view('givepower', $map_point);
return $entities;