You are here

protected function LingotekMetadataEditForm::flagViolations in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()
  2. 4.0.x src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()
  3. 3.0.x src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()
  4. 3.1.x src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()
  5. 3.2.x src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()
  6. 3.3.x src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()
  7. 3.4.x src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()
  8. 3.5.x src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()
  9. 3.6.x src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()
  10. 3.7.x src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()
  11. 3.8.x src/Form/LingotekMetadataEditForm.php \Drupal\lingotek\Form\LingotekMetadataEditForm::flagViolations()

Flags violations for the current 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 to array returned by getEditedFieldNames() and overwrite this method in order to show any violations for those fields; e.g.:

foreach ($violations
  ->getByField('name') as $violation) {
  $form_state
    ->setErrorByName('name', $violation
    ->getMessage());
}
parent::flagViolations($violations, $form, $form_state);

Parameters

\Drupal\Core\Entity\EntityConstraintViolationListInterface $violations: The violations to flag.

array $form: A nested array of form elements comprising the form.

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

Overrides ContentEntityForm::flagViolations

File

src/Form/LingotekMetadataEditForm.php, line 229

Class

LingotekMetadataEditForm

Namespace

Drupal\lingotek\Form

Code

protected function flagViolations(EntityConstraintViolationListInterface $violations, array $form, FormStateInterface $form_state) {

  // ToDo
  // We ignore violations.
}