function filter_get_roles_by_format
7.x filter.module | 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.
4 calls to filter_get_roles_by_format()
- FilterFormatAccessTestCase::testFormatRoles in drupal-7.x/
modules/ filter/ filter.test - Tests if text format is available to a role.
- filter_admin_format_form in drupal-7.x/
modules/ filter/ filter.admin.inc - Form constructor for the text format add/edit form.
- filter_admin_overview in drupal-7.x/
modules/ filter/ filter.admin.inc - Page callback: Form constructor for a form to list and reorder text formats.
- filter_get_formats_by_role in drupal-7.x/
modules/ filter/ filter.module - Retrieves a list of text formats that are allowed for a given role.
File
- drupal-7.x/
modules/ filter/ filter.module, line 468 - Framework for handling the filtering of content.
Code
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();
}