Commit 33ade8c2 authored by alexpott's avatar alexpott

Issue #2143519 by followup yched, swentel: Allow FieldInstance yml files to...

Issue #2143519 by followup yched, swentel: Allow FieldInstance yml files to refer to the Field by field name rather than by field_uuid.
parent 3e69d365
......@@ -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'])));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment