diff --git a/core/lib/Drupal/Core/Field/FieldDefinition.php b/core/lib/Drupal/Core/Field/FieldDefinition.php index 708d2fe..c12c71f 100644 --- a/core/lib/Drupal/Core/Field/FieldDefinition.php +++ b/core/lib/Drupal/Core/Field/FieldDefinition.php @@ -336,7 +336,7 @@ public function getPropertyNames() { */ public function getMainPropertyName() { $class = $this->getFieldItemClass(); - return $class::getMainPropertyName(); + return $class::mainPropertyName(); } /** diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php index af0e38e..da5263a 100644 --- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php @@ -30,7 +30,7 @@ public function validate($value, Constraint $constraint) { // If the data is complex, we have to validate its main property. if ($typed_data instanceof ComplexDataInterface) { - $name = $typed_data->getMainPropertyName(); + $name = $typed_data->getDataDefinition()->getMainPropertyName(); if (!isset($name)) { throw new \LogicException('Cannot validate allowed values for complex data without a main property.'); } diff --git a/core/modules/field/lib/Drupal/field/Entity/Field.php b/core/modules/field/lib/Drupal/field/Entity/Field.php index 96ba183..332d794 100644 --- a/core/modules/field/lib/Drupal/field/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Entity/Field.php @@ -837,7 +837,7 @@ public function getPropertyNames() { */ public function getMainPropertyName() { $class = $this->getFieldItemClass(); - return $class::getMainPropertyName(); + return $class::mainPropertyName(); } /**