protected function UserAccountFormFieldsTest::buildAccountForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/user/src/Tests/UserAccountFormFieldsTest.php \Drupal\user\Tests\UserAccountFormFieldsTest::buildAccountForm()
Builds the user account form for a given operation.
Parameters
string $operation: The entity operation; one of 'register' or 'default'.
Return value
array The form array.
2 calls to UserAccountFormFieldsTest::buildAccountForm()
- UserAccountFormFieldsTest::testUserEditForm in core/
modules/ user/ src/ Tests/ UserAccountFormFieldsTest.php - Tests the user edit form.
- UserAccountFormFieldsTest::testUserRegistrationForm in core/
modules/ user/ src/ Tests/ UserAccountFormFieldsTest.php - Tests the user registration form.
File
- core/
modules/ user/ src/ Tests/ UserAccountFormFieldsTest.php, line 134 - Contains \Drupal\user\Tests\UserAccountFormFieldsTest.
Class
- UserAccountFormFieldsTest
- Verifies that the field order in user account forms is compatible with password managers of web browsers.
Namespace
Drupal\user\TestsCode
protected function buildAccountForm($operation) {
// @see HtmlEntityFormController::getFormObject()
$entity_type = 'user';
$fields = array();
if ($operation != 'register') {
$fields['uid'] = 2;
}
$entity = $this->container
->get('entity.manager')
->getStorage($entity_type)
->create($fields);
$form_object = $this->container
->get('entity.manager')
->getFormObject($entity_type, $operation)
->setEntity($entity);
// @see EntityFormBuilder::getForm()
return $this->container
->get('entity.form_builder')
->getForm($entity, $operation);
}