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) { 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')
->referencedEntities()) { && $attributions = $variables['element']['#entity']->get('field_image_attribution')
->referencedEntities()) {
$attribution = $attributions[0]; $attribution = $attributions[0];
$author = $attribution->get('field_attribution_author')->getValue()[0]; $author = $attribution->get('field_attribution_author')->getValue()[0];

Loading…
Cancel
Save