You are here

protected function ContentEntityForm::getEditedFieldNames in Drupal 10

Same name and namespace in other branches
  1. 8 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 the entity form customly 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…
4 methods override ContentEntityForm::getEditedFieldNames()
AccountForm::getEditedFieldNames in core/modules/user/src/AccountForm.php
Gets the names of all fields edited in the form.
CommentForm::getEditedFieldNames in core/modules/comment/src/CommentForm.php
Gets the names of all fields edited in the form.
TermForm::getEditedFieldNames in core/modules/taxonomy/src/TermForm.php
Gets the names of all fields edited in the form.
WorkspaceForm::getEditedFieldNames in core/modules/workspaces/src/Form/WorkspaceForm.php
Gets the names of all fields edited in the form.

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());
}