You are here

function private_content_form_node_type_form_builder in Private content 8.2

Entity builder for the node type form with private option.

See also

private_content_form_node_type_form_alter()

1 string reference to 'private_content_form_node_type_form_builder'
private_content_form_node_type_form_alter in ./private_content.module
Implements hook_form_FORM_ID_alter().

File

./private_content.module, line 202
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_form_node_type_form_builder($entity_type, NodeTypeInterface $type, &$form, FormStateInterface $form_state) {
  $existing = $type
    ->getThirdPartySetting('private_content', 'private');
  $new = $form_state
    ->getValue('private');
  $type
    ->setThirdPartySetting('private_content', 'private', $new);
  if ($new != $existing) {
    node_access_needs_rebuild(TRUE);
  }
}