function filter_get_roles_by_format

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.

File

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!filter!filter.module/function/filter_get_roles_by_format/7.x