You are here

function bear_form_node_form_alter in Bear 8

Implements hook_form_BASE_FORM_ID_alter() for node_form().

Hide promote and sticky form elements.

Hide revision information from users who do not have permission to view content revisions.

File

./bear.profile, line 44
Enables modules and site configuration for a bear site installation.

Code

function bear_form_node_form_alter(&$form, FormStateInterface $form_state) {
  if (isset($form['promote'])) {
    $form['promote']['#access'] = FALSE;
  }
  if (isset($form['sticky'])) {
    $form['sticky']['#access'] = FALSE;
  }
  if (isset($form['actions']['preview'])) {
    $form['actions']['preview']['#access'] = FALSE;
  }
  if (!\Drupal::currentUser()
    ->hasPermission('view all revisions')) {
    if (isset($form['revision_information'])) {
      $form['revision_information']['#access'] = FALSE;
    }
  }
}