You are here

protected function UserProfile::createEntity in Flexiform 8

Create a new entity ready for this situation.

1 call to UserProfile::createEntity()
UserProfile::getEntity in src/Plugin/FlexiformFormEntity/UserProfile.php
Get the Entity.

File

src/Plugin/FlexiformFormEntity/UserProfile.php, line 100

Class

UserProfile
Form Entity for getting profiles from a user object.

Namespace

Drupal\flexiform\Plugin\FlexiformFormEntity

Code

protected function createEntity() {
  $values = [
    'type' => $this
      ->getBundle(),
    'uid' => [
      'entity' => $this
        ->getContextValue('user'),
    ],
  ];
  $entity = $this->entityTypeManager
    ->getStorage('profile')
    ->create($values);
  $this->moduleHandler
    ->invokeAll('flexiform_form_entity_entity_create', [
    $entity,
    $this,
  ]);
  return $entity;
}