You are here

function nodejs_subscribe_form_node_form_alter in Node.js integration 7

Implements hook_form_BASE_FORM_ID_alter().

File

nodejs_subscribe/nodejs_subscribe.module, line 91

Code

function nodejs_subscribe_form_node_form_alter(&$form, $form_state) {
  $subscriptions_allowed = FALSE;
  if (!empty($form['#node']->nid)) {
    if (isset($form['#node']->nodejs_subscribe)) {
      $subscriptions_allowed = $form['#node']->nodejs_subscribe ? '1' : '0';
    }
  }
  $form['nodejs_subscribe'] = array(
    '#type' => 'fieldset',
    '#title' => t('Realtime notifications'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'additional_settings',
    '#attributes' => array(
      'class' => array(
        'nodejs-subscribe-form',
      ),
    ),
    '#access' => TRUE,
    '#weight' => 30,
    '#tree' => TRUE,
  );
  $form['nodejs_subscribe']['nodejs_subscriptions_allowed'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow users to subscribe'),
    '#description' => t('Allow users to subscribe for realtime notifications'),
    '#default_value' => $subscriptions_allowed,
  );
}