You are here

function private_content_get_default in Private 8.2

Return default value for private field, based on the node's content type.

Parameters

\Drupal\node\NodeInterface $node: Node to check

Return value

boolean Default value

1 call to private_content_get_default()
private_content_get_value in ./private_content.module
Return value for private field, sanitised based on the node's content type.

File

./private_content.module, line 281
A tremendously simple access control module -- it allows users to mark individual nodes as private; users with 'access private content' perms can read these nodes, while others cannot.

Code

function private_content_get_default(NodeInterface $node) {

  /** @var \Drupal\node\NodeTypeInterface $type */
  $type = $node->type->entity;
  if (is_null($type)) {

    // Occurs during Content type creation.
    return FALSE;
  }
  $type_setting = $type
    ->getThirdPartySetting('private_content', 'private', PRIVATE_ALLOWED);
  return $type_setting == PRIVATE_ALWAYS || $type_setting == PRIVATE_AUTOMATIC;
}