You are here

function xbbcode_settings_handlers in Extensible BBCode 8

Same name and namespace in other branches
  1. 5 xbbcode-settings.php \xbbcode_settings_handlers()
  2. 6 xbbcode.admin.inc \xbbcode_settings_handlers()
  3. 7 xbbcode.admin.inc \xbbcode_settings_handlers()

Modify the global handler settings.

1 string reference to 'xbbcode_settings_handlers'
xbbcode_menu in ./xbbcode.module
Implements hook_menu().

File

./xbbcode.admin.inc, line 265
Administrative interface for modifying tags and settings.

Code

function xbbcode_settings_handlers($form, &$form_state) {

  // Load the database interface.
  module_load_include('inc', 'xbbcode', 'xbbcode.crud');

  // Find out which formats use global settings.
  $formats = xbbcode_formats();
  $form = array(
    'global' => array(),
    'tags' => array(),
  );
  $form['global'] = array(
    '#weight' => -1,
    '#markup' => t('You are changing the global settings.'),
  );
  foreach ($formats as &$list) {
    foreach ($list as $format_id => $format_name) {
      $list[$format_id] = l($format_name, 'admin/config/content/formats/' . $format_id);
    }
  }
  if (!empty($formats['specific'])) {
    if (!empty($formats['global'])) {
      $form['global']['#markup'] .= ' ' . t('The following formats are affected by the global settings:');
      $form['global']['#markup'] .= '<ul><li>' . implode('</li><li>', $formats['global']) . '</li></ul>';
    }
    else {
      $form['global']['#markup'] .= ' ' . t('All formats using XBBCode currently override the global settings, so they have no effect.');
    }
    $form['global']['#markup'] .= ' ' . t('The following formats override the global settings, and will not be affected:');
    $form['global']['#markup'] .= '<ul><li>' . implode('</li><li>', $formats['specific']) . '</li></ul>';
  }
  else {
    $form['global']['#markup'] .= ' ' . t('All formats currently follow the global settings.');
  }
  $form['tags'] = xbbcode_settings_handlers_format();
  $form['save'] = array(
    '#type' => 'submit',
    '#name' => 'op',
    '#value' => t('Save changes'),
    '#submit' => array(
      'xbbcode_settings_handlers_save_submit',
    ),
  );
  return $form;
}