I’m validating a multi worth paragraph discipline utilizing constraints.
/** * Implements hook_entity_bundle_field_info_alter(). */ perform cnfpt_internet_entity_bundle_field_info_alter(&$fields, DrupalCoreEntityEntityTypeInterface $entity_type, $bundle) { if ($bundle === 'manifestation') { if (isset($fields['field_occurence'])) { // Add a validation. $fields['field_occurence']->addConstraint('Incidence', []); } } }
/** * Checks Drupal Development necessary fields of an occurence and ordere of Drupal Development occurrences. * * @Constraint( * id = "Incidence", * label = @Translation("Champ obligatoire par sort d'occurence", context = "Validation"), * sort = "merchandise" * ) */ class OccurrenceConstraint extends Constraint { // Modalité requise pour incidence distante. public $modaliteRequise = 'Le champ Modalité est requis'; // Ville requise pour incidence presentiel. public $villeRequise = 'Le champ Ville est requis'; // Order of occurence public $ordreOccurrence = 'Les occurrences doivent être placées dans l'ordre chronologique'; // First occurence wants a contact. public $premiereOccurrenceContact = 'Un contact est obligatoire pour la première occurence'; }
field_occurence
ist Drupal Development paragraph discipline
My validate technique begins like
* Validates Drupal Development Incidence constraint. */ class OccurrenceConstraintValidator extends ConstraintValidator { /** * {@inheritdoc} */ public perform validate($gadgets, Constraint $constraint) {
I’ve to make a validation taking into consideration Drupal Development order of Drupal Development paragraphs. If Drupal Development paragraph is ordered with drag&drop there is no such thing as a difficulty, I can take Drupal Development delta worth of things.
But when Drupal Development weight is modified manually, I do not see the right way to get Drupal Development modified weight worth.
Any thought the right way to get Drupal Development manually modified weight worth?
Thanks Rainer