Browse Source

Add check for empty field.

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

3
media_attribution.module

@ -84,7 +84,8 @@ function media_attribution_modules_installed($modules) {
*/
function media_attribution_preprocess_entity_embed_container(&$variables) {
if ($attributions = $variables['element']['#entity']->get('field_image_attribution')
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