You are here

function nodereferrer_view_handler_argument_type_filter in NodeReferrer 5

File

./nodereferrer.module, line 478
Defines a field type for backlinking referencing nodes. @todo -clear content cache with nodeapi. -query nids for access on load/view..

Code

function nodereferrer_view_handler_argument_type_filter(&$query, $argtype, $arg = null) {
  $nid = (int) $arg;
  $fields = array_keys(nodereferrer_nodereference_field_options());
  $node_type = $argtype['options'];
  $referrers = nodereferrer_referrers($nid, $fields, array(
    $node_type,
  ));
  if (empty($referrers)) {
    $referrers = array(
      0 => 0,
    );
  }
  $query
    ->add_where('node.nid in (' . implode(',', array_keys($referrers)) . ') ');
}