} $edited_fields =
array_unique($edited_fields);
} else { $edited_fields =
$this->
getEditedFieldNames($form_state);
} // Remove violations for fields that are not edited.
$violations->
filterByFields(array_diff(array_keys($entity->
getFieldDefinitions()),
$edited_fields));
$this->
flagViolations($violations,
$form,
$form_state);
// The entity was validated.
$entity->
setValidationRequired(FALSE
);
$form_state->
setTemporaryValue('entity_validated', TRUE
);
return $entity;
} /**
* 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.
*
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @return string[]
* An array of field names.
*/