You are here

function workflow_current_user in Workflow 8

Wrapper function to get a UserInterface object.

Parameters

\Drupal\Core\Session\AccountInterface|null $account: An Account.

Return value

\Drupal\user\UserInterface A User to check permissions, since we can't add Roles to AccountInterface.

11 calls to workflow_current_user()
WorkflowAccessControlHandler::access in src/WorkflowAccessControlHandler.php
Checks access to an operation on a given entity or entity translation.
WorkflowDefaultWidget::massageFormValues in src/Plugin/Field/FieldWidget/WorkflowDefaultWidget.php
Implements workflow_transition() -> WorkflowDefaultWidget::submit().
WorkflowItem::getPossibleOptions in src/Plugin/Field/FieldType/WorkflowItem.php
Returns an array of possible values with labels for display.
WorkflowItem::getSettableOptions in src/Plugin/Field/FieldType/WorkflowItem.php
Returns an array of settable values with labels for display.
WorkflowManager::executeTransitionsOfEntity in src/Entity/WorkflowManager.php
Execute a single transition for the given entity.

... See full list

File

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

Code

function workflow_current_user(AccountInterface $account = NULL) {
  if (!$account) {
    $account = \Drupal::currentUser();
  }
  return User::load($account
    ->id());
}