Browse Source

Fix white screen when no license is present.

8.x-1.x 8.x-1.0-beta9
Alexander O'Neill 4 years ago
parent
commit
65b385503b
  1. 4
      media_attribution.module

4
media_attribution.module

@ -85,11 +85,13 @@ function media_attribution_preprocess_field__paragraph__field_attribution_author
function media_attribution_preprocess_paragraph__license_attribution__license_attribution(&$variables) {
$variables['license_prefix'] = \Drupal::translation()->translate('Licensed under');
$items = $variables['elements']['field_license']['#items'];
if (!empty($items)) {
$referencedEntity = $variables['elements']['field_license']['#items']
->first()->get('entity')->getTarget()->getValue();
$variables['license_link'] = $referencedEntity->get('field_license_link')->first()->view();
}
}
/**

Loading…
Cancel
Save