filter_get_formats_by_role

Versions
7
filter_get_formats_by_role($rid)

Retrieves a list of text formats that are allowed for a given role.

Parameters

$rid The user role ID to retrieve text formats for.

Return value

An array of text format objects that are allowed for the role, keyed by the text format ID and ordered by weight.

Code

modules/filter/filter.module, line 420

<?php
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->format] = $format;
    }
  }
  return $formats;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.