programmatically getting custom node belonging to a term

588 views Asked by At

have searched google but cannot find anything specific . Intention is to get all Custom Node types that have been assigned a specific term of vocabulary . for example the follwoing is a db query to get custom node type.

$query->condition('type', "news_article")->fields('n',array('nid'))->orderBy('created', 'DESC')->range(0,90);

can the same query be modified to also add the filter for term id .

One other related question is that how can (in PHP) we get the term id from the url of the pattern e.g <drupal site>/taxonomy/term/2 .

any help appreciated

0

There are 0 answers