|
|
|
@ -78,6 +78,19 @@ function media_attribution_modules_installed($modules) {
|
|
|
|
|
media_attribution_load_default_licenses(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function media_attribution_preprocess_field__paragraph__field_attribution_author__license_attribution(&$variables) { |
|
|
|
|
$variables['source_prefix'] = \Drupal::translation()->translate('by'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function media_attribution_preprocess_paragraph__license_attribution__license_attribution(&$variables) { |
|
|
|
|
$variables['license_prefix'] = \Drupal::translation()->translate('Licensed under'); |
|
|
|
|
|
|
|
|
|
$referencedEntity = $variables['elements']['field_license']['#items'] |
|
|
|
|
->first()->get('entity')->getTarget()->getValue(); |
|
|
|
|
|
|
|
|
|
$variables['license_link'] = $referencedEntity->get('field_license_link')->first()->view(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implementation of hook_preprocess_entity_embed_container(). |
|
|
|
|
* |
|
|
|
@ -155,3 +168,16 @@ function media_attribution_load_default_licenses() {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function media_attribution_theme() { |
|
|
|
|
return [ |
|
|
|
|
'paragraph__license_attribution__license_attribution' => [ |
|
|
|
|
'base hook' => 'paragraph', |
|
|
|
|
], |
|
|
|
|
'field__paragraph__field_attribution_source__license_attribution' => [ |
|
|
|
|
'base hook' => 'field', |
|
|
|
|
], |
|
|
|
|
'field__paragraph__field_attribution_author__license_attribution' => [ |
|
|
|
|
'base hook' => 'field', |
|
|
|
|
], |
|
|
|
|
]; |
|
|
|
|
} |