1 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 unindexed array of role names.:

File

core/modules/filter/filter.module, line 858
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 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();
}