Browse Source

Fix warnings.

8.x-1.x 8.x-1.0-beta11
Alexander O'Neill 3 years ago
parent
commit
5a69c32588
  1. 5
      media_attribution.module

5
media_attribution.module

@ -85,7 +85,7 @@ function media_attribution_preprocess_field__paragraph__field_attribution_author
function media_attribution_preprocess_paragraph__license_attribution__license_attribution(&$variables) { function media_attribution_preprocess_paragraph__license_attribution__license_attribution(&$variables) {
$variables['license_prefix'] = \Drupal::translation()->translate('Licensed under'); $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)) { if (!empty($items)) {
$referencedEntity = $variables['elements']['field_license']['#items'] $referencedEntity = $variables['elements']['field_license']['#items']
->first()->get('entity')->getTarget()->getValue(); ->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') && $attributions = $variables['element']['#entity']->get('field_image_attribution')
->referencedEntities()) { ->referencedEntities()) {
$attribution = $attributions[0]; $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] : ''; $source = $attribution->get('field_attribution_source')->count() > 0 ? $attribution->get('field_attribution_source')->getValue()[0] : '';
$license = $attribution->get('field_license')->entity; $license = $attribution->get('field_license')->entity;

Loading…
Cancel
Save