diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php index 5efe7ac..6d84487 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php @@ -66,15 +66,15 @@ public static function schema(FieldDefinitionInterface $field_definition) { * {@inheritdoc} */ public function getConstraints() { - $constraint_manager = \Drupal::typedDataManager()->getValidationConstraintManager(); $constraints = parent::getConstraints(); if ($max_length = $this->getFieldSetting('max_length')) { + $constraint_manager = \Drupal::typedDataManager()->getValidationConstraintManager(); $constraints[] = $constraint_manager->create('ComplexData', array( 'value' => array( 'Length' => array( 'max' => $max_length, - 'maxMessage' => t('%name: the text may not be longer than @max characters.', array('%name' => $this->getFieldDefinition()->getLabel(), '@max' => $max_length)), + //'maxMessage' => t('%name: the text may not be longer than @max characters.', array('%name' => $this->getFieldDefinition()->getLabel(), '@max' => $max_length)), ) ), )); diff --git a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextLongItem.php b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextLongItem.php index e27a477..7e378fc 100644 --- a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextLongItem.php +++ b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextLongItem.php @@ -67,9 +67,4 @@ public function instanceSettingsForm(array $form, array &$form_state) { return $element; } - /** - * {@inheritdoc} - */ - public function getConstraints() {} - } diff --git a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextWithSummaryItem.php b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextWithSummaryItem.php index fec7d3c..36df950 100644 --- a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextWithSummaryItem.php +++ b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextWithSummaryItem.php @@ -116,9 +116,4 @@ public function instanceSettingsForm(array $form, array &$form_state) { return $element; } - /** - * {@inheritdoc} - */ - public function getConstraints() {} - } diff --git a/core/modules/user/lib/Drupal/user/Entity/User.php b/core/modules/user/lib/Drupal/user/Entity/User.php index f9db482..0c197da 100644 --- a/core/modules/user/lib/Drupal/user/Entity/User.php +++ b/core/modules/user/lib/Drupal/user/Entity/User.php @@ -473,7 +473,7 @@ public static function baseFieldDefinitions($entity_type) { $fields['signature'] = FieldDefinition::create('string') ->setLabel(t('Signature')) ->setDescription(t('The signature of this user.')) - ->setPropertyConstraints('value', array('Length' => array('max' => 255))); + ->setSetting('max_length', 255); $fields['signature_format'] = FieldDefinition::create('string') ->setLabel(t('Signature format')) ->setDescription(t('The signature format of this user.'));