You are here

function quotes_admin_settings in Quotes 6

Same name and namespace in other branches
  1. 7 quotes.admin.inc \quotes_admin_settings()

Displays the general admin settings form.

Return value

An array containing the form elements to be displayed.

2 string references to 'quotes_admin_settings'
quotes_admin_settings_page in ./quotes.admin.inc
Displays the admin settings page.
quotes_menu in ./quotes.module
Implementation of hook_menu().

File

./quotes.admin.inc, line 33
The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.

Code

function quotes_admin_settings() {
  $form = array();
  $myjs = drupal_get_path('module', 'quotes') . '/quotes.admin.js';
  $vert_tabs = array(
    'js' => array(
      'vertical-tabs' => $myjs,
    ),
  );
  $yesno = array(
    t('No'),
    t('Yes'),
  );
  $count = db_result(db_query("SELECT COUNT(*) FROM {node} n where n.type='quotes' AND n.status=1"));
  $form['count'] = array(
    '#type' => 'item',
    '#value' => t('There are currently !count published quotations.', array(
      '!count' => $count,
    )),
  );
  $form['display'] = array(
    '#type' => 'fieldset',
    '#title' => t('Display Options'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#attached' => $vert_tabs,
    '#description' => t('These options are for general theming.'),
    '#group' => 'display',
  );
  $form['display']['quotes_per_page'] = array(
    '#type' => 'textfield',
    '#title' => t('Quotes per page'),
    '#size' => 6,
    '#default_value' => variable_get('quotes_per_page', 10),
    '#description' => t('The number of quotes included on a page.'),
    '#prefix' => '<div class="clear-block"></div>',
  );
  $form['display']['quotes_leader'] = array(
    '#type' => 'textfield',
    '#title' => t('Author leader'),
    '#default_value' => variable_get('quotes_leader', '&mdash;'),
    '#description' => t('The text placed before the author attribution (e.g. "&amp;mdash;" for an em-dash or "&amp;#8226;" for a bullet).'),
  );
  $form['display']['quotes_author_link'] = array(
    '#type' => 'radios',
    '#options' => $yesno,
    '#title' => t('Make author a link'),
    '#attributes' => array(
      'class' => 'container-inline',
    ),
    '#prefix' => '<div id="author-link">',
    '#suffix' => '</div>',
    '#default_value' => variable_get('quotes_author_link', FALSE),
    '#description' => t('If selected, the author text will be a link to show all quotes by that author.'),
  );
  $form['display']['quotes_author_bio'] = array(
    '#type' => 'radios',
    '#options' => array(
      0 => t("Don't display"),
      1 => t('Include text'),
      2 => t('Include as a link'),
    ),
    '#title' => t("Include author's bio"),
    '#default_value' => variable_get('quotes_author_bio', FALSE),
    '#description' => t("If selected, the author's biography will be shown on the Quotes page."),
    '#attributes' => array(
      'class' => 'container-inline',
    ),
    '#prefix' => '<div id="author-bio">',
    '#suffix' => '</div>',
  );
  $format_list = filter_formats();
  $formats = array(
    FILTER_FORMAT_DEFAULT => '-node format-',
  );
  foreach ($format_list as $number => $filter) {
    $formats[$number] = $filter->name;
  }
  $form['display']['quotes_format'] = array(
    '#type' => 'radios',
    '#options' => $formats,
    '#title' => t('Author, citation, and bio input format'),
    '#default_value' => variable_get('quotes_format', 0),
    '#description' => t('This will be used as the input format for the author, citation, and bio fields.'),
    '#attributes' => array(
      'class' => 'container-inline',
    ),
    '#prefix' => '<div id="quotes-format">',
    '#suffix' => '</div>',
    '#group' => 'display',
  );
  $form['display']['quotes_edit_link'] = array(
    '#type' => 'radios',
    '#options' => $yesno,
    '#title' => t('Add an "edit" link'),
    '#default_value' => variable_get('quotes_edit_link', TRUE),
    '#description' => t('If selected, an "edit" link will be shown for each quote.'),
    '#attributes' => array(
      'class' => 'container-inline',
    ),
    '#prefix' => '<div id="quotes-edit-link">',
    '#suffix' => '</div>',
    '#group' => 'display',
  );
  $form['display']['quotes_quick_nav_original'] = array(
    '#type' => 'value',
    '#value' => variable_get('quotes_quick_nav', TRUE),
  );
  $form['display']['quotes_quick_nav'] = array(
    '#type' => 'radios',
    '#options' => $yesno,
    '#title' => t('Show quick navigation tabs'),
    '#default_value' => variable_get('quotes_quick_nav', TRUE),
    '#description' => t('If selected, quick navigation tabs will be shown at the top of the quotes page.'),
    '#attributes' => array(
      'class' => 'container-inline',
    ),
    '#prefix' => '<div id="quotes-quick-nav">',
    '#suffix' => '</div>',
    '#group' => 'display',
  );
  $form['myquotes'] = array(
    '#type' => 'fieldset',
    '#title' => t('My Quotes links'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['myquotes']['quotes_showlink'] = array(
    '#type' => 'radios',
    '#options' => $yesno,
    '#title' => t('Show link to users\' quotes'),
    '#attributes' => array(
      'class' => 'container-inline',
    ),
    '#prefix' => '<div id="quotes-user-link">',
    '#suffix' => '</div>',
    '#default_value' => variable_get('quotes_showlink', TRUE),
    '#description' => t('Uncheck this to disable the link to each users\' "my quotes" page when viewing a node.'),
  );
  $form['myquotes']['quotes_show_myquotes_original'] = array(
    '#type' => 'value',
    '#value' => variable_get('quotes_show_myquotes', TRUE),
  );
  $form['myquotes']['quotes_show_myquotes'] = array(
    '#type' => 'radios',
    '#options' => $yesno,
    '#title' => t('Show the "my quotes" menu item'),
    '#attributes' => array(
      'class' => 'container-inline',
    ),
    '#prefix' => '<div id="quotes-myquotes">',
    '#suffix' => '</div>',
    '#default_value' => variable_get('quotes_show_myquotes', TRUE),
    '#description' => t('Uncheck this to disable the "My quotes" menu item for all users. Note, changing this setting will <a href="!url">require the menu to be rebuilt</a>.', array(
      '!url' => url('admin/settings/performance'),
    )),
  );
  $form['user'] = array(
    '#type' => 'fieldset',
    '#title' => t('User Options'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#description' => t('These options are for users.'),
    '#group' => 'user',
  );
  $form['user']['quotes_user_recent'] = array(
    '#type' => 'radios',
    '#options' => $yesno,
    '#title' => t('Add a "Quotes" tab on the "My account" page'),
    '#attributes' => array(
      'class' => 'container-inline',
    ),
    '#prefix' => '<div id="myquotes-tab">',
    '#suffix' => '</div>',
    '#default_value' => variable_get('quotes_user_recent', 0),
  );

  // Add a submit handler to force a menu rebuild, if needed.
  $form['#submit'][] = '_quotes_settings_form_submit';
  return system_settings_form($form);
}