You are here

function notifications_content_form_node_type_form_alter in Notifications 7

Implements hook_form_FORM_ID_alter().

Per content-type notifications options

File

notifications_content/notifications_content.module, line 151
Subscriptions to content events

Code

function notifications_content_form_node_type_form_alter(&$form, $form_state) {
  if (isset($form['type'])) {
    $form['notifications'] = array(
      '#type' => 'fieldset',
      '#title' => t('Notifications settings'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#group' => 'additional_settings',
      '#attributes' => array(
        'class' => array(
          'notifications-node-type-settings-form',
        ),
      ),
    );
    $form['notifications']['notifications_content_type'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Allowed subscription types'),
      '#default_value' => variable_get('notifications_content_type_' . $form['#node_type']->type, array()),
      '#options' => _notifications_content_type_options(),
      '#description' => t('Enable different subscription options for this content type.'),
    );
    if (!variable_get('notifications_content_per_type', 0)) {
      $form['notifications']['notifications_content_type']['#disabled'] = TRUE;
      $form['notifications']['notifications_content_type']['#description'] .= ' <strong>' . t('To enable these options check the <a href="@notifications-settings">Notifications content settings</a>', array(
        '@notifications-settings' => url('admin/config/messaging/subscriptions/content'),
      )) . '</strong>';
    }
  }
}