function ContentEntityForm::getEditedFieldNames

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::getEditedFieldNames()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::getEditedFieldNames()
  3. 10 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.

5 calls to 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.
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…
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.
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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.