You are here

function private_content_is_locked in Private 8.2

Return whether private field is locked (not-writeable), based on the node's content type.

Parameters

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

Return value

boolean True if locked.

2 calls to private_content_is_locked()
private_content_entity_field_access in ./private_content.module
Implements hook_entity_field_access().
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 302
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_is_locked(NodeInterface $node) {

  /** @var \Drupal\node\NodeTypeInterface $type */
  $type = $node->type->entity;
  $type_setting = $type
    ->getThirdPartySetting('private_content', 'private', PRIVATE_ALLOWED);
  return $type_setting == PRIVATE_ALWAYS || $type_setting == PRIVATE_DISABLED;
}