From 77456421b8ab81b831633059c78c730c92a52a34 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Thu, 9 Jan 2014 11:24:08 +0000 Subject: [PATCH] Issue #1231710 by Hydra, dcam, kathyh, klausi, mlncn: Field exceptions should return the name of the field that has exceptions. --- core/modules/field/lib/Drupal/field/Entity/Field.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/modules/field/lib/Drupal/field/Entity/Field.php b/core/modules/field/lib/Drupal/field/Entity/Field.php index 6d5e68aac8dc..6e536b81fdc0 100644 --- a/core/modules/field/lib/Drupal/field/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Entity/Field.php @@ -225,13 +225,13 @@ public function __construct(array $values, $entity_type = 'field_entity') { throw new FieldException('Attempt to create an unnamed field.'); } if (!preg_match('/^[_a-z]+[_a-z0-9]*$/', $values['name'])) { - throw new FieldException('Attempt to create a field with invalid characters. Only lowercase alphanumeric characters and underscores are allowed, and only lowercase letters and underscore are allowed as the first character'); + throw new FieldException(format_string('Attempt to create a field @field_name with invalid characters. Only lowercase alphanumeric characters and underscores are allowed, and only lowercase letters and underscore are allowed as the first character', array('@field_name' => $values['name']))); } if (empty($values['type'])) { - throw new FieldException('Attempt to create a field with no type.'); + throw new FieldException(format_string('Attempt to create field @field_name with no type.', array('@field_name' => $values['name']))); } if (empty($values['entity_type'])) { - throw new FieldException('Attempt to create a field with no entity_type.'); + throw new FieldException(format_string('Attempt to create a field @field_name with no entity_type.', array('@field_name' => $values['name']))); } parent::__construct($values, $entity_type); @@ -451,7 +451,7 @@ public function getSchema() { // Check that the schema does not include forbidden column names. if (array_intersect(array_keys($schema['columns']), static::getReservedColumns())) { - throw new FieldException('Illegal field type columns.'); + throw new FieldException(format_string('Illegal field type @field_type on @field_name.', array('@field_type' => $this->type, '@field_name' => $this->name))); } // Merge custom indexes with those specified by the field type. Custom -- GitLab