public function AccountInfo::buildEntities in Flexiform 8
Overrides FormElementBaseTrait::buildEntities
File
- src/
Plugin/ FormElement/ AccountInfo.php, line 99
Class
- AccountInfo
- Form element class for user accounts.
Namespace
Drupal\flexiform\Plugin\FormElementCode
public function buildEntities(array $form, FormStateInterface $form_state) {
/** @var \Drupal\user\UserInterface $account */
$account = $this
->getContext('account')
->getContextValue();
$element_values = $form_state
->getValue($form['#parents']);
// Set the existing password of set in form state.
$current_pass = trim($element_values['current_pass']);
if (strlen($current_pass) > 0) {
$account
->setExistingPassword($current_pass);
}
$account->pass->value = $element_values['pass'];
$account->name->value = $element_values['name'];
$account->mail->value = $element_values['mail'];
}