Skip to content

Instantly share code, notes, and snippets.

@fmfpereira
Created October 28, 2019 00:32
Show Gist options
  • Save fmfpereira/70d1959a4788884c32ba0b3d6ddeda4d to your computer and use it in GitHub Desktop.
Save fmfpereira/70d1959a4788884c32ba0b3d6ddeda4d to your computer and use it in GitHub Desktop.
Fix issue with destination as an array for layout builder.
diff --git a/linked_field.module b/linked_field.module
index 1bbcb82..4d513ad 100644
--- a/linked_field.module
+++ b/linked_field.module
@@ -349,6 +349,11 @@ function linked_field_entity_display_build_alter(&$build, $context) {
// Normalize the settings.
$destination = isset($settings['destination']) ? $settings['destination'] : FALSE;
+ // Fix issue with destination as an array for layout builder.
+ if (is_array($destination)) {
+ $destination = array_filter($destination);
+ $destination = reset($destination);
+ }
$linked = isset($settings['linked']) ? $settings['linked'] : FALSE;
$destination_type = isset($settings['type']) ? $settings['type'] : 'custom';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment