Drupal サイトのクエリを作成する必要があります。最初は、コンテンツ タイプのノード数をカウントする必要がありました。
$query = "SELECT COUNT(*) amount FROM {node} n WHERE n.type ='A'";
$result = db_query($query)->fetch();
return $result->amount;
これが必要なのは、field_b が「X」に等しいノードに対してのみです。これどうやってするの?
I tried EntityFieldQuery without sucess:
$query = new EntityFieldQuery;
$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'A')
->fieldCondition('field_b', 'value', 'X');
$results = $query->execute();
return $results->amount;
何か助けはありますか?