|
|
|
@ -85,7 +85,7 @@ 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']; |
|
|
|
|
$items = isset($variables['elements']['field_license']['#items']) ? $variables['elements']['field_license']['#items'] : []; |
|
|
|
|
if (!empty($items)) { |
|
|
|
|
$referencedEntity = $variables['elements']['field_license']['#items'] |
|
|
|
|
->first()->get('entity')->getTarget()->getValue(); |
|
|
|
@ -105,7 +105,8 @@ function media_attribution_preprocess_entity_embed_container(&$variables) {
|
|
|
|
|
&& $attributions = $variables['element']['#entity']->get('field_image_attribution') |
|
|
|
|
->referencedEntities()) { |
|
|
|
|
$attribution = $attributions[0]; |
|
|
|
|
$author = $attribution->get('field_attribution_author')->getValue()[0]; |
|
|
|
|
$author_field = $attribution->get('field_attribution_author')->getValue(); |
|
|
|
|
$author = isset($author_field[0]) ? $author_field[0] : ''; |
|
|
|
|
|
|
|
|
|
$source = $attribution->get('field_attribution_source')->count() > 0 ? $attribution->get('field_attribution_source')->getValue()[0] : ''; |
|
|
|
|
$license = $attribution->get('field_license')->entity; |
|
|
|
|