filter_get_roles_by_format

Versions
7
filter_get_roles_by_format($format)

Retrieves a list of roles that are allowed to use a given text format.

Parameters

$format An object representing the text format.

Return value

An array of role names, keyed by role ID.

▾ 3 functions call filter_get_roles_by_format()

filter_admin_format_form in modules/filter/filter.admin.inc
Generate a text format form.
filter_admin_overview in modules/filter/filter.admin.inc
Menu callback; Displays a list of all text formats and allows them to be rearranged.
filter_get_formats_by_role in modules/filter/filter.module
Retrieves a list of text formats that are allowed for a given role.

Code

modules/filter/filter.module, line 376

<?php
function filter_get_roles_by_format($format) {
  // Handle the fallback format upfront (all roles have access to this format).
  if ($format->format == filter_fallback_format()) {
    return user_roles();
  }
  // Do not list any roles if the permission does not exist.
  $permission = filter_permission_name($format);
  return !empty($permission) ? user_roles(FALSE, $permission) : array();
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.