You are here

public function UserController::addForm in Profile 8

Builds the profile add form.

Parameters

\Drupal\user\UserInterface $user: The user account.

\Drupal\profile\Entity\ProfileTypeInterface $profile_type: The profile type.

Return value

array The response.

1 call to UserController::addForm()
UserController::singlePage in src/Controller/UserController.php
Builds the add/edit page for "single" profile types.
1 string reference to 'UserController::addForm'
profile.routing.yml in ./profile.routing.yml
profile.routing.yml

File

src/Controller/UserController.php, line 89

Class

UserController
Provides the profile UI for users.

Namespace

Drupal\profile\Controller

Code

public function addForm(UserInterface $user, ProfileTypeInterface $profile_type) {
  $profile = $this
    ->entityTypeManager()
    ->getStorage('profile')
    ->create([
    'uid' => $user
      ->id(),
    'type' => $profile_type
      ->id(),
  ]);
  return $this
    ->entityFormBuilder()
    ->getForm($profile, 'add');
}