You are here

function simplenews_form_alter in Simplenews 5

Same name and namespace in other branches
  1. 6.2 simplenews.module \simplenews_form_alter()
  2. 6 simplenews.module \simplenews_form_alter()
  3. 7.2 simplenews.module \simplenews_form_alter()
  4. 7 simplenews.module \simplenews_form_alter()

Implementation of hook_form_alter().

File

./simplenews.module, line 508

Code

function simplenews_form_alter($form_id, &$form) {
  $vid = variable_get('simplenews_vid', '');

  // Newsletter vocabulary form
  if ($form_id == 'taxonomy_form_vocabulary' && isset($form['vid']) && $form['vid']['#value'] == $vid) {

    // Hide critical options from forum vocabulary.
    $form['help_forum_vocab'] = array(
      '#value' => t('This is the designated simplenews vocabulary. This vocabulary can not be deleted.'),
      '#weight' => -1,
    );
    $form['nodes']['#required'] = TRUE;
    $form['nodes']['#description'] = t('Select content type(s) to be used as newsletter');
    $form['multiple'] = array(
      '#type' => 'value',
      '#value' => FALSE,
    );

    // Prevent the vocabulary gets deleted
    unset($form['delete']);
  }
}