class UsernameEventVariables in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 modules/preprocess_event_dispatcher/src/Variables/UsernameEventVariables.php \Drupal\preprocess_event_dispatcher\Variables\UsernameEventVariables
Class UsernameEventVariables.
Hierarchy
- class \Drupal\preprocess_event_dispatcher\Variables\AbstractEventVariables
- class \Drupal\preprocess_event_dispatcher\Variables\UsernameEventVariables
Expanded class hierarchy of UsernameEventVariables
2 files declare their use of UsernameEventVariables
- OtherEventVariablesTest.php in modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ OtherEventVariablesTest.php - UsernamePreprocessEventFactory.php in modules/
preprocess_event_dispatcher/ src/ Factory/ UsernamePreprocessEventFactory.php
File
- modules/
preprocess_event_dispatcher/ src/ Variables/ UsernameEventVariables.php, line 10
Namespace
Drupal\preprocess_event_dispatcher\VariablesView source
class UsernameEventVariables extends AbstractEventVariables {
/**
* Whether the user is anonymous or not.
*
* @return bool
* Is it?
*/
public function userIsAnonymous() : bool {
return $this
->getAccount()
->isAnonymous();
}
/**
* Get the user account.
*
* @return \Drupal\user\UserInterface
* The user account.
*/
public function getAccount() : UserInterface {
return $this->variables['account'];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractEventVariables:: |
protected | property | Variables. | |
AbstractEventVariables:: |
public | function | Get a variable with a given name, return default if it does not exist. | 1 |
AbstractEventVariables:: |
public | function | Get a variable with a given name by reference. | 1 |
AbstractEventVariables:: |
public | function | Remove a given variable. | 1 |
AbstractEventVariables:: |
public | function | Set a variable to a given value. | 1 |
AbstractEventVariables:: |
public | function | Event Variables constructor. | |
UsernameEventVariables:: |
public | function | Get the user account. | |
UsernameEventVariables:: |
public | function | Whether the user is anonymous or not. |