function node_access_test_form_node_form_alter

Implements hook_form_BASE_FORM_ID_alter().

File

drupal/core/modules/node/tests/modules/node_access_test/node_access_test.module, line 183
A dummy module implementing node access related hooks for testing purposes.

Code

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,
    );
  }
}