|
|
@ -36,8 +36,10 @@ function entity_embed_attribution_help($route_name, RouteMatchInterface $route_m |
|
|
|
* Add attribution form to media embed forms and view displays. |
|
|
|
* Add attribution form to media embed forms and view displays. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function entity_embed_attribution_modules_installed($modules) { |
|
|
|
function entity_embed_attribution_modules_installed($modules) { |
|
|
|
foreach (['media_browser', 'default'] as $form_variant) { |
|
|
|
|
|
|
|
|
|
|
|
foreach (['default', 'media_browser'] as $form_variant) { |
|
|
|
$form_entity = EntityFormDisplay::load("media.image.$form_variant"); |
|
|
|
$form_entity = EntityFormDisplay::load("media.image.$form_variant"); |
|
|
|
|
|
|
|
if (!empty($form_entity)) { |
|
|
|
$form_entity->setComponent('field_image_attribution', |
|
|
|
$form_entity->setComponent('field_image_attribution', |
|
|
|
[ |
|
|
|
[ |
|
|
|
'region' => 'content', |
|
|
|
'region' => 'content', |
|
|
@ -60,16 +62,17 @@ function entity_embed_attribution_modules_installed($modules) { |
|
|
|
]) |
|
|
|
]) |
|
|
|
->save(); |
|
|
|
->save(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
foreach (['embedded', 'default'] as $entity_view_variant) { |
|
|
|
foreach (['default', 'embedded'] as $entity_view_variant) { |
|
|
|
$view_entity = EntityViewDisplay::load("media.image.$entity_view_variant"); |
|
|
|
$view_entity = EntityViewDisplay::load("media.image.$entity_view_variant"); |
|
|
|
|
|
|
|
if (!empty($view_entity)) { |
|
|
|
$view_entity->setComponent('field_image_attribution', [ |
|
|
|
$view_entity->setComponent('field_image_attribution', [ |
|
|
|
'type' => 'entity_reference_revisions_entity_view', |
|
|
|
'type' => 'entity_reference_revisions_entity_view', |
|
|
|
'label' => 'hidden', |
|
|
|
'label' => 'hidden', |
|
|
|
'settings' => ['view_mode' => 'default', 'link' => ''], |
|
|
|
'settings' => ['view_mode' => 'default', 'link' => ''], |
|
|
|
])->save(); |
|
|
|
])->save(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// Load default license terms from the module config. |
|
|
|
// Load default license terms from the module config. |
|
|
|
entity_embed_attribution_load_default_licenses(); |
|
|
|
entity_embed_attribution_load_default_licenses(); |
|
|
|
} |
|
|
|
} |
|
|
@ -118,7 +121,6 @@ function entity_embed_attribution_preprocess_entity_embed_container(&$variables) |
|
|
|
|
|
|
|
|
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
// $attribution_string = \Drupal::render($attribution_text); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$variables['children'] = [ |
|
|
|
$variables['children'] = [ |
|
|
|
'first' => [ |
|
|
|
'first' => [ |
|
|
|