You are here

function filter_admin_overview in Drupal 5

Same name and namespace in other branches
  1. 4 modules/filter.module \filter_admin_overview()
  2. 6 modules/filter/filter.admin.inc \filter_admin_overview()
  3. 7 modules/filter/filter.admin.inc \filter_admin_overview()

Displays a list of all input formats and which one is the default

1 string reference to 'filter_admin_overview'
filter_menu in modules/filter/filter.module
Implementation of hook_menu().

File

modules/filter/filter.module, line 300
Framework for handling filtering of content.

Code

function filter_admin_overview() {

  // Overview of all formats.
  $formats = filter_formats();
  $error = FALSE;
  foreach ($formats as $id => $format) {
    $roles = array();
    foreach (user_roles() as $rid => $name) {

      // Prepare a roles array with roles that may access the filter
      if (strstr($format->roles, ",{$rid},")) {
        $roles[] = $name;
      }
    }
    $default = $id == variable_get('filter_default_format', 1);
    $options[$id] = '';
    $form[$format->name]['id'] = array(
      '#value' => $id,
    );
    $form[$format->name]['roles'] = array(
      '#value' => $default ? t('All roles may use default format') : ($roles ? implode(', ', $roles) : t('No roles may use this format')),
    );
    $form[$format->name]['configure'] = array(
      '#value' => l(t('configure'), 'admin/settings/filters/' . $id),
    );
    $form[$format->name]['delete'] = array(
      '#value' => $default ? '' : l(t('delete'), 'admin/settings/filters/delete/' . $id),
    );
  }
  $form['default'] = array(
    '#type' => 'radios',
    '#options' => $options,
    '#default_value' => variable_get('filter_default_format', 1),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Set default format'),
  );
  return $form;
}