Issue #2143519 by followup yched, swentel: Allow FieldInstance yml files to refer to the Field by field name rather than by field_uuid.
parent
3e69d365d8
commit
33ade8c229
|
@ -240,8 +240,10 @@ class FieldInstanceConfig extends ConfigEntityBase implements FieldInstanceConfi
|
||||||
*/
|
*/
|
||||||
public function __construct(array $values, $entity_type = 'field_instance_config') {
|
public function __construct(array $values, $entity_type = 'field_instance_config') {
|
||||||
// Field instances configuration is stored with a 'field_uuid' property
|
// Field instances configuration is stored with a 'field_uuid' property
|
||||||
// unambiguously identifying the field.
|
// unambiguously identifying the field. We only take it into account if a
|
||||||
if (isset($values['field_uuid'])) {
|
// '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']);
|
$field = field_info_field_by_id($values['field_uuid']);
|
||||||
if (!$field) {
|
if (!$field) {
|
||||||
throw new FieldException(format_string('Attempt to create an instance of unknown field @uuid', array('@uuid' => $values['field_uuid'])));
|
throw new FieldException(format_string('Attempt to create an instance of unknown field @uuid', array('@uuid' => $values['field_uuid'])));
|
||||||
|
|
Loading…
Reference in New Issue