1 filter.module filter_get_roles_by_format($format)

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


$format: An object representing the text format.

Return value

An unindexed array of role names.:


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


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 array_keys(user_roles());
  // Do not list any roles if the permission does not exist.
  $permission = filter_permission_name($format);
  return !empty($permission) ? array_keys(user_roles(FALSE, $permission)) : array();