Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::getEditedFieldNames()
  2. 9 core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::getEditedFieldNames()

Gets the names of all fields edited in the form.

If a custom entity form adds some fields to the form (i.e. without using the form display), it needs to add its fields here and override flagViolations() for displaying the violations.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

string[] An array of field names.

1 call to ContentEntityForm::getEditedFieldNames()
ContentEntityForm::validateForm in core/lib/Drupal/Core/Entity/ContentEntityForm.php
Button-level validation handlers are highly discouraged for entity forms, as they will prevent entity validation from running. If the entity is going to be saved during the form submission, this method should be manually invoked from the button-level…

File

core/lib/Drupal/Core/Entity/ContentEntityForm.php, line 236

Class

ContentEntityForm
Entity form variant for content entity types.

Namespace

Drupal\Core\Entity

Code

protected function getEditedFieldNames(FormStateInterface $form_state) {
  return array_keys($this
    ->getFormDisplay($form_state)
    ->getComponents());
}