You are here

function allowed_languages_get_current_user in Allowed Languages 8

Get the current user.

This will return a user entity and not the account proxy.

Return value

\Drupal\Core\Entity\EntityInterface|\Drupal\user\UserInterface|null The current user entity.

2 calls to allowed_languages_get_current_user()
AllowedLanguages::query in src/Plugin/views/filter/AllowedLanguages.php
Add this filter to the query.
allowed_languages_pre_render_language_select in ./allowed_languages.module
Pre-render function for the language select widget.

File

./allowed_languages.module, line 226
Contains allowed_languages.module.

Code

function allowed_languages_get_current_user() {
  $account = \Drupal::currentUser();
  return \Drupal::entityTypeManager()
    ->getStorage('user')
    ->load($account
    ->id());
}