Issue #2143519 by followup yched, swentel: Allow FieldInstance yml files to refer to the Field by field name rather than by field_uuid.

8.0.x
Alex Pott 2014-03-06 10:25:32 +00:00
parent 3e69d365d8
commit 33ade8c229
1 changed files with 4 additions and 2 deletions

View File

@ -240,8 +240,10 @@ class FieldInstanceConfig extends ConfigEntityBase implements FieldInstanceConfi
*/
public function __construct(array $values, $entity_type = 'field_instance_config') {
// Field instances configuration is stored with a 'field_uuid' property
// unambiguously identifying the field.
if (isset($values['field_uuid'])) {
// unambiguously identifying the field. We only take it into account if a
// 'uuid' entry is present too, so that leftover 'field_uuid' entries
// present in config files imported as "default module config" are ignored.
if (isset($values['field_uuid']) && isset($values['uuid'])) {
$field = field_info_field_by_id($values['field_uuid']);
if (!$field) {
throw new FieldException(format_string('Attempt to create an instance of unknown field @uuid', array('@uuid' => $values['field_uuid'])));