You are here

function flag_node::type_access_multiple in Flag 7.2

Same name and namespace in other branches
  1. 6.2 flag.inc \flag_node::type_access_multiple()
  2. 7.3 includes/flag/flag_node.inc \flag_node::type_access_multiple()

File

./flag.inc, line 1566
Implements various flags. Uses object oriented style inspired by that of Views 2.

Class

flag_node
Implements a node flag.

Code

function type_access_multiple($content_ids, $account) {
  $access = array();

  // If all subtypes are allowed, we have nothing to say here.
  if (empty($this->types)) {
    return $access;
  }

  // Ensure that only flaggable node types are granted access. This avoids a
  // node_load() on every type, usually done by applies_to_content_id().
  $result = db_select('node', 'n')
    ->fields('n', array(
    'nid',
  ))
    ->condition('nid', array_keys($content_ids), 'IN')
    ->condition('type', $this->types, 'NOT IN')
    ->execute();
  foreach ($result as $row) {
    $access[$row->nid] = FALSE;
  }
  return $access;
}