protected function ContentEntityForm::getEditedFieldNames

protected ContentEntityForm::getEditedFieldNames(FormStateInterface $form_state)

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.

File

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

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!ContentEntityForm.php/function/ContentEntityForm::getEditedFieldNames/8.1.x