diff --git a/media_attribution.module b/media_attribution.module index 1e8917d..753a11c 100644 --- a/media_attribution.module +++ b/media_attribution.module @@ -107,10 +107,10 @@ function media_attribution_preprocess_entity_embed_container(&$variables) { $attribution = $attributions[0]; $author = $attribution->get('field_attribution_author')->getValue()[0]; - $source = $attribution->get('field_attribution_source')->getValue()[0]; + $source = $attribution->get('field_attribution_source')->count() > 0 ? $attribution->get('field_attribution_source')->getValue()[0] : ''; $license = $attribution->get('field_license')->entity; $license_link = !empty($license) ? $license->get('field_license_link')->getValue()[0] : FALSE; - $attribution_note = $attribution->get('field_attribution_note')->getValue()[0]; + $attribution_note = $attribution->get('field_attribution_note')->count() > 0 ? $attribution->get('field_attribution_note')->getValue()[0]: ''; $attribution_text = []; if (!empty($source['uri'])) { $attribution_text['source'] = [