You are here

function node_limit_load in Node Limit 8

Same name and namespace in other branches
  1. 6 node_limit.module \node_limit_load()
  2. 7 node_limit.module \node_limit_load()

Loads a node limit.

Parameters

int $lid: The limit id.

Return value

array|false FALSE if the limit couldn't be loaded; otherwise the limit rule.

1 call to node_limit_load()
_node_limit_violates_limit in old/node_limit.module
Helper function to check limit violations for this node.

File

old/node_limit.module, line 623

Code

function node_limit_load($lid) {
  if (!is_numeric($lid)) {
    return FALSE;
  }
  $info = \Drupal::database()
    ->select('node_limit', 'nl')
    ->fields('nl')
    ->condition('lid', $lid)
    ->execute()
    ->fetchAssoc();
  if ($info['lid'] == $lid && intval($lid) >= 0) {

    // Load up the information from the other modules
    // perhaps this isn't necessary.  does node_limit ever use the other modules info?
    // yes (for setting the default state of the "applies" checkbox when editing a limit).
    $res = module_invoke_all('node_limit_load', $lid);
    return array_merge($info, $res);
  }
  else {
    return FALSE;
  }
}