Browse Source

Add check for empty field.

wip 8.x-1.0-beta3
Alexander O'Neill 6 years ago
parent
commit
9c6d34ef9e
  1. 5
      media_attribution.module

5
media_attribution.module

@ -84,8 +84,9 @@ function media_attribution_modules_installed($modules) {
*/
function media_attribution_preprocess_entity_embed_container(&$variables) {
if ($attributions = $variables['element']['#entity']->get('field_image_attribution')
->referencedEntities()) {
if ($variables['element']['#entity']->hasField('field_image_attribution')
&& $attributions = $variables['element']['#entity']->get('field_image_attribution')
->referencedEntities()) {
$attribution = $attributions[0];
$author = $attribution->get('field_attribution_author')->getValue()[0];

Loading…
Cancel
Save