1 filter.module filter_permission()

Implements hook_permission().

File

core/modules/filter/filter.module, line 637
Framework for handling the filtering of content.

Code

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,
    'warning' => t('Permit any HTML tag in content (e.g.: <code>&lt;script&gt;</code>) and/or allow file uploads of any filetype via CKEditor.'),
  );

  $perms['upload editor images'] = array(
    'title' => t('Upload images through editor dialogs'),
    'description' => t('Allow users with access to image dialogs to upload files.'),
  );

  $perms['upload editor files'] = array(
    'title' => t('Upload files through editor dialogs'),
    'description' => t('Allow users with access to editor dialogs to upload files.'),
  );

  // 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 = l($format->name, 'admin/config/content/formats/' . $format->format);
      $perms[$permission] = array(
        'title' => t("Use the !text_format text format", array('!text_format' => $format_name_replacement,)),
        'description' => backdrop_placeholder(t('Warning: This permission may have security implications depending on how the text format is configured.')),
      );
    }
  }
  return $perms;
}