getContextValue('user'); return [ '#prefix' => '
', '#suffix' => '
', '#markup' => $user ? $user->getUsername() : 'No context mapping selected.' , ]; } /** * {@inheritdoc} */ protected function blockAccess(AccountInterface $account) { if ($this->getContextValue('user') instanceof UserInterface) { $this->messenger()->addStatus('User context found.'); } return parent::blockAccess($account); } }