| Versions | |
|---|---|
| 4.7 – 6 | filter_admin_overview() |
| 7 | filter_admin_overview($form) |
Displays a list of all input formats and which one is the default
modules/
<?php
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/filters/' . $id));
$form[$format->name]['delete'] = array('#value' => $default ? '' : l(t('delete'), 'admin/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 drupal_get_form('filter_admin_overview', $form);
}
?>