Session Entity

Categories

Component ID

2743381

Component name

Session Entity

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

410

Component created

Component changed

Component body

Session Entity provides entities which are stored in the user's session. Each
user has one entity, which they may edit (provided they have the permission).
This is a normal content entity, which may have fields added to it.

This allows anonymous users to create content which will automatically expire
when their session expires.

The module uses a custom entity storage controller to store entity data in
the private tempstore.

Example uses include allowing site visitors to select preferences or set details
about themselves such as a location.

To retrieve the session entity for the current user:

  $session_entity = Drupal::service('session_entity.current')->getCurrentUserSessionEntity();