Implements hook_form_BASE_FORM_ID_alter().
function node_access_test_form_node_form_alter(&$form, $form_state) {
// Only show this checkbox for NodeAccessBaseTableTestCase.
if (Drupal::state()
->get('node_access_test.private')) {
$node = $form_state['controller']
->getEntity($form_state);
$form['private'] = array(
'#type' => 'checkbox',
'#title' => t('Private'),
'#description' => t('Check here if this content should be set private and only shown to privileged users.'),
'#default_value' => isset($node->private) ? $node->private : FALSE,
);
}
}