public static function ProfileFormWidget::validateProfileForm in Profile 8
Validates the profile form.
Parameters
array $element: The profile form element.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Plugin/ Field/ FieldWidget/ ProfileFormWidget.php, line 281
Class
- ProfileFormWidget
- Plugin implementation of the 'profile_form' widget.
Namespace
Drupal\profile\Plugin\Field\FieldWidgetCode
public static function validateProfileForm(array &$element, FormStateInterface $form_state) {
/** @var \Drupal\profile\Entity\ProfileInterface $profile */
$property = [
'profiles',
$element['#bundle'],
];
$profile = $form_state
->get($property);
if (!empty($profile)) {
assert($profile instanceof ProfileInterface);
$form_display = EntityFormDisplay::collectRenderDisplay($profile, $element['#form_mode']);
$form_display
->extractFormValues($profile, $element, $form_state);
$form_display
->validateFormValues($profile, $element, $form_state);
}
}