filter_get_roles_by_format(FilterFormatInterface $format)
Retrieves a list of roles that are allowed to use a given text format.
\Drupal\filter\FilterFormatInterface $format: An object representing the text format.
array An array of role names, keyed by role ID.
function filter_get_roles_by_format(FilterFormatInterface $format) { // Handle the fallback format upfront (all roles have access to this format). if ($format->isFallbackFormat()) { return user_role_names(); } // Do not list any roles if the permission does not exist. $permission = $format->getPermissionName(); return !empty($permission) ? user_role_names(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/core!modules!filter!filter.module/function/filter_get_roles_by_format/8.1.x