You are here

function views_ui_get_roles in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 includes/admin.inc \views_ui_get_roles()
  2. 6.2 includes/admin.inc \views_ui_get_roles()

Get a list of roles in the system.

2 calls to views_ui_get_roles()
views_plugin_access_role::options_form in plugins/views_plugin_access_role.inc
Provide the default form for setting options.
views_plugin_access_role::summary_title in plugins/views_plugin_access_role.inc
Return a string to display as the clickable title for the access control.

File

includes/admin.inc, line 4918
Provides the Views' administrative interface.

Code

function views_ui_get_roles() {
  static $roles = NULL;
  if (!isset($roles)) {
    $roles = array();
    $result = db_query("SELECT r.rid, r.name FROM {role} r ORDER BY r.name");
    foreach ($result as $obj) {
      $roles[$obj->rid] = $obj->name;
    }
  }
  return $roles;
}