You are here

function xbbcode_list_admin_settings in Extensible BBCode 8

Same name and namespace in other branches
  1. 5 xbbcode_list/xbbcode_list.module \xbbcode_list_admin_settings()
  2. 6 xbbcode_list/xbbcode_list.module \xbbcode_list_admin_settings()
  3. 7 xbbcode_list/xbbcode_list.module \xbbcode_list_admin_settings()
1 string reference to 'xbbcode_list_admin_settings'
xbbcode_list_menu in xbbcode_list/xbbcode_list.module

File

xbbcode_list/xbbcode_list.module, line 94

Code

function xbbcode_list_admin_settings($form_state) {
  drupal_add_js(drupal_get_path('module', 'xbbcode_list') . '/xbbcode_list.js');
  $settings = variable_get('xbbcode_list', array(
    'type' => 'ol',
    'ol' => array(
      'style' => 'hierarchy',
      'classes' => array(
        'numeric',
        'lower-alpha',
        'lower-roman',
      ),
    ),
  ));
  $form['#tree'] = TRUE;
  $form['type'] = array(
    '#type' => 'radios',
    '#title' => t('Default list type'),
    '#description' => t('Choose whether [list] is numbered or non-numbered by default. Users can override the default by using [ul] or [ol].'),
    '#options' => array(
      'ol' => t('Numbered'),
      'ul' => t('Non-numbered'),
    ),
    '#default_value' => $settings['type'],
  );
  $form['ol'] = array(
    '#type' => 'fieldset',
    '#title' => t('Ordered list settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('Configure how to display lists with numbered items.'),
  );
  $form['ul'] = array(
    '#type' => 'fieldset',
    '#title' => t('Unordered list settings'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#description' => t('Configure how to display lists with non-numbered items.'),
  );
  $form['ol']['style'] = array(
    '#type' => 'radios',
    '#title' => t('Ordered list default'),
    '#description' => t('Ordered lists will look like this by default. The style can be overridden with [ol=sections] and [ol=levels]'),
    '#options' => array(
      'sections' => t('Sectioned (this works only in a browser with CSS 2.0 support!)'),
      'hierarchy' => t('Hierarchical levels'),
    ),
    '#default_value' => $settings['ol']['style'],
  );
  $form['ol']['example'] = array(
    '#markup' => '
<ol id="xbbocde_list_sample_1" class="numeric">
  <li>' . t('Fruit') . '
    <ol id="xbbocde_list_sample_2" class="lower-alpha">
      <li>' . t('Citrus') . '
        <ol id="xbbocde_list_sample_3" class="lower-roman">
          <li>' . t('Lemon') . '</li>
          <li>' . t('Orange') . '</li>
        </ol>
      </li>
    </ol>
  </li>
</ol>',
  );
  $form['ol']['classes'] = array(
    '#type' => 'textfield',
    '#title' => t('Style levels'),
    '#description' => t('Enter a comma-separated list of styles that will be used by nested lists. Valid styles are: %list. Deeper levels will repeat the lowest level that was defined.', array(
      '%list' => 'upper-roman, lower-roman, numeric, upper-alpha, lower-alpha, none',
    )),
    '#default_value' => implode(', ', $settings['ol']['classes']),
    '#autocomplete_path' => 'admin/config/content/lists/autocomplete',
    '#element_validate' => array(
      'xbbcode_list_style_validate',
    ),
  );
  return $form;
}