You are here

function subscriptions_ui_form_alter in Subscriptions 5.2

Implementation of hook form_alter().

Adds the Display Settings part to the admin/settings/subscriptions form.

File

./subscriptions_ui.module, line 300
Provides a user interface for Subscriptions.

Code

function subscriptions_ui_form_alter($form_id, &$form) {
  global $user;
  $tr = 't';
  if ($form_id == 'subscriptions_settings_form') {
    $form['display_settings'] = array(
      '#type' => 'fieldset',
      '#title' => t('Display settings'),
      '#collapsible' => TRUE,
      '#weight' => -4,
    );
    $form['display_settings']['subscriptions_form_in_block'] = array(
      '#type' => 'radios',
      '#title' => t('Node form position'),
      '#options' => array(
        t('Fieldset above node links (and comments)'),
        // 0
        t('Fieldset in %block block (below the comments)', array(
          '%block' => t('Subscriptions interface'),
        )),
      ),
      '#default_value' => variable_get('subscriptions_form_in_block', 0),
      '#description' => t('How to display the subscriptions sub-form on node pages.  Default is the first option.<br />To use the block, <b>you must enable the block</b> !here; put it into the %content region and set the %block_title to !none.', array(
        '!here' => l(t('here'), 'admin/build/block'),
        '%content' => 'content',
        '%block_title' => $tr('Block title'),
        '!none' => '<em>&lt;none&gt;</em>',
      )),
    );
    $form['display_settings']['subscriptions_form_link_only'] = array(
      '#type' => 'radios',
      '#title' => t('Node form visibility'),
      '#options' => array(
        t('Always display the fieldset'),
        // 0
        t('Display only a @subscribe link that makes the fieldset visible', array(
          '@subscribe' => t('Subscribe'),
        )),
      ),
      '#default_value' => variable_get('subscriptions_form_link_only', 0),
      '#description' => t('What to display.  Default is the first option.'),
    );
    $form['display_settings']['subscriptions_form_expanded'] = array(
      '#type' => 'checkbox',
      '#title' => t('Expand the node form fieldset'),
      '#default_value' => variable_get('subscriptions_form_expanded', 0),
      '#description' => t('Displays the fieldset with the node page subscriptions sub-form in expanded state.  Default is OFF.'),
    );
    $form['display_settings']['note'] = array(
      '#value' => '<p>' . t("Note: Our <b>favorite display settings</b> are the exact opposites of the defaults, but we chose the defaults, because they work without enabling the Subscriptions block.") . '</p>',
    );
    $form['display_settings']['subscriptions_show_by_author_options'] = array(
      '#type' => 'checkbox',
      '#title' => t("Show 'by author' subscriptions options"),
      '#default_value' => variable_get('subscriptions_show_by_author_options', 1),
      '#description' => t("If you don't want your users to subscribe 'by author', then turn this off.  Default is ON."),
    );
  }
}