You are here

function node_limit_save in Node Limit 8

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

Callback to save a node limit back to the database.

Parameters

array $limit: The limit data.

2 calls to node_limit_save()
node_limit_clone_limit in old/node_limit.module
Callback to clone a limit.
node_limit_limit_form_submit in old/node_limit.module
Submission hook for node_limit_limit_form.

File

old/node_limit.module, line 678

Code

function node_limit_save(array $limit) {
  node_limit_delete($limit['lid'], TRUE);
  \Drupal::database()
    ->insert('node_limit')
    ->fields(array(
    'lid' => $limit['lid'],
    'nlimit' => $limit['nlimit'],
    'title' => $limit['title'],
    'weight' => $limit['weight'],
  ))
    ->execute();
  $modules = module_implements('node_limit_save');
  foreach ($modules as $module) {
    $applies = isset($limit[$module]);
    $element = $applies ? $limit[$module] : '';
    module_invoke($module, 'node_limit_save', $limit['lid'], $applies, $element);
  }
}