function filter_get_formats_by_role
filter_get_formats_by_role($rid)
Retrieves a list of text formats that are allowed for a given role.
Parameters
string $rid: The user role ID to retrieve text formats for.
Return value
\Drupal\filter\FilterFormatInterface[] An array of text format objects that are allowed for the role, keyed by the text format ID and ordered by weight.
File
- core/modules/filter/filter.module, line 168
- Framework for handling the filtering of content.
Code
function filter_get_formats_by_role($rid) { $formats = array(); foreach (filter_formats() as $format) { $roles = filter_get_roles_by_format($format); if (isset($roles[$rid])) { $formats[$format->id()] = $format; } } return $formats; }
© 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_formats_by_role/8.1.x