public function FlagServiceInterface::populateFlaggerDefaults in Flag 8.4
Set up values for the flagger user account and session.
This is a helper method for functions that allow the flagger account to be omitted to mean the current user.
If you always want the current user, you can use this as follows:
$account = $session_id = NULL;
\Drupal::service('flag')
->populateFlaggerDefaults($account, $session_id);
Parameters
\Drupal\Core\Session\AccountInterface $account: A user account, or a variable set to NULL (rather than the constant NULL) to get the current user assigned to it.
string $session_id: A session ID, or a variable set to NULL to get the session ID assigned to it in the case that the user also unspecified and anonymous. If $account is not NULL and is the anonymous user, then this must be specified, and in this case, it is the caller's responsibility to ensure that the session is properly started.
Throws
\LogicException Throws an exception is $account is specified and is the anonymous user, but $session_id is NULL.
1 method overrides FlagServiceInterface::populateFlaggerDefaults()
- FlagService::populateFlaggerDefaults in src/
FlagService.php - Set up values for the flagger user account and session.
File
- src/
FlagServiceInterface.php, line 326
Class
- FlagServiceInterface
- Flag service interface.
Namespace
Drupal\flagCode
public function populateFlaggerDefaults(AccountInterface &$account = NULL, &$session_id = NULL);