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.
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 