function bueditor_sorted_roles in BUEditor 6
Same name and namespace in other branches
- 5 bueditor.module \bueditor_sorted_roles()
- 6.2 admin/bueditor.admin.inc \bueditor_sorted_roles()
- 7 admin/bueditor.admin.inc \bueditor_sorted_roles()
Sort roles according to their weights.
1 call to bueditor_sorted_roles()
- bueditor_admin_form in ./
bueditor.admin.inc - Admin form.
File
- ./
bueditor.admin.inc, line 470
Code
function bueditor_sorted_roles() {
static $sorted;
if (!isset($sorted)) {
$sorted = array();
$roles = user_roles();
$broles = variable_get('bueditor_roles', array());
$broles[DRUPAL_ANONYMOUS_RID]['weight'] = 12;
$broles[DRUPAL_AUTHENTICATED_RID]['weight'] = 11;
foreach ($roles as $rid => $name) {
$sorted[$rid] = array(
'name' => $name,
'weight' => (int) $broles[$rid]['weight'],
'editor' => (int) $broles[$rid]['editor'],
'alt' => (int) $broles[$rid]['alt'],
);
}
uasort($sorted, 'bueditor_rolesort');
}
return $sorted;
}