You are here

function content_access_get_per_node_settings in Content Access 8

Same name and namespace in other branches
  1. 5 content_access.module \content_access_get_per_node_settings()
  2. 6 content_access.module \content_access_get_per_node_settings()
  3. 7 content_access.module \content_access_get_per_node_settings()

Gets the per node settings of a node.

@note This function won't apply defaults, so if there are no other settings it will return an empty array.

2 calls to content_access_get_per_node_settings()
ContentAccessPageForm::buildForm in src/Form/ContentAccessPageForm.php
Form constructor.
content_access_per_node_setting in ./content_access.module
Access per node setting.

File

./content_access.module, line 498
Content access module file.

Code

function content_access_get_per_node_settings(NodeInterface $node) {
  $query = \Drupal::database()
    ->query("SELECT settings FROM {content_access} WHERE nid = :nid", [
    ':nid' => $node
      ->id(),
  ]);
  $result = $query
    ->fetch(PDO::FETCH_OBJ);
  if (!empty($result->settings)) {
    return unserialize($result->settings);
  }
  return [];
}