You are here

function _workflow_roles_to_rids in Workflow 7

Translates a role string to RIDs for importing.

Parameters

$role_string: A string of roles or fake 'author' role.

Return value

A string of RIDs separated by commas.

1 call to _workflow_roles_to_rids()
workflow_update_workflows_full_object in ./workflow.features.inc
For use by CRUD only, save everything from the CRUD formed object.

File

./workflow.features.inc, line 245
Integrates workflow with features.

Code

function _workflow_roles_to_rids($role_string) {
  $roles = _workflow_user_roles();
  $rid_array = array();
  foreach (explode(',', $role_string) as $role_name) {
    if ($role_name === WORKFLOW_FEATURES_AUTHOR_NAME) {
      $rid_array[] = 'author';
    }
    elseif ($role_name && in_array($role_name, $roles)) {
      $rid_array[] = array_search($role_name, $roles);
    }
  }
  return implode(',', $rid_array);
}