Implements hook_permission().
function filter_permission() {
$perms['administer filters'] = array(
'title' => t('Administer text formats and filters'),
'description' => t('Define how text is handled by combining filters into <a href="@url">text formats</a>.', array(
'@url' => url('admin/config/content/formats'),
)),
'restrict access' => TRUE,
);
// Generate permissions for each text format. Warn the administrator that any
// of them are potentially unsafe.
foreach (filter_formats() as $format) {
$permission = filter_permission_name($format);
if (!empty($permission)) {
// Only link to the text format configuration page if the user who is
// viewing this will have access to that page.
$format_name_replacement = user_access('administer filters') ? l($format->name, 'admin/config/content/formats/' . $format->format) : drupal_placeholder($format->name);
$perms[$permission] = array(
'title' => t("Use the !text_format text format", array(
'!text_format' => $format_name_replacement,
)),
'description' => drupal_placeholder(t('Warning: This permission may have security implications depending on how the text format is configured.')),
);
}
}
return $perms;
}