You are here

function workflow_get_roles in Workflow 7.2

Same name and namespace in other branches
  1. 5.2 workflow.module \workflow_get_roles()
  2. 5 workflow.module \workflow_get_roles()
  3. 6.2 workflow.module \workflow_get_roles()
  4. 6 workflow.module \workflow_get_roles()

Get a list of roles.

Return value

array Array of role names keyed by role ID, including the 'author' role.

9 calls to workflow_get_roles()
theme_workflow_admin_ui_transitions_form in workflow_admin_ui/workflow_admin_ui.page.transitions.inc
Theme the workflow editing form.
Workflow::rebuildRoles in includes/Entity/Workflow.php
WorkflowFeaturesController::sanitize_workflow_for_export in ./workflow.features.inc
Prepares the provided workflow for export.
WorkflowItem::settingsForm in includes/Field/WorkflowItem.php
Implements hook_field_settings_form() -> ConfigFieldItemInterface::settingsForm().
workflow_access_form in workflow_access/workflow_access.pages.inc
Implements hook_form().

... See full list

File

./workflow.module, line 577
Support workflows made up of arbitrary states.

Code

function workflow_get_roles($permission = 'participate in workflow', $translate_roles = TRUE) {
  static $roles = NULL;
  if (!$roles[$permission]) {
    $role_author_name = $translate_roles ? t(WORKFLOW_ROLE_AUTHOR_NAME) : WORKFLOW_ROLE_AUTHOR_NAME;
    $roles[$permission][WORKFLOW_ROLE_AUTHOR_RID] = '(' . $role_author_name . ')';
    foreach (user_roles(FALSE, $permission) as $rid => $role_name) {
      $roles[$permission][$rid] = $translate_roles ? check_plain(t($role_name)) : $role_name;
    }
  }
  return $roles[$permission];
}