2018-01-09 21:26:04 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Post update functions for Media.
|
|
|
|
*/
|
|
|
|
|
2022-09-30 10:20:29 +00:00
|
|
|
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
|
|
|
|
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
|
|
|
use Drupal\media\MediaConfigUpdater;
|
|
|
|
|
2018-12-07 13:10:26 +00:00
|
|
|
/**
|
2020-03-11 20:58:38 +00:00
|
|
|
* Implements hook_removed_post_updates().
|
2018-12-07 13:10:26 +00:00
|
|
|
*/
|
2020-03-11 20:58:38 +00:00
|
|
|
function media_removed_post_updates() {
|
|
|
|
return [
|
|
|
|
'media_post_update_collection_route' => '9.0.0',
|
|
|
|
'media_post_update_storage_handler' => '9.0.0',
|
|
|
|
'media_post_update_enable_standalone_url' => '9.0.0',
|
|
|
|
'media_post_update_add_status_extra_filter' => '9.0.0',
|
2022-08-11 12:02:30 +00:00
|
|
|
'media_post_update_modify_base_field_author_override' => '10.0.0',
|
2020-03-11 20:58:38 +00:00
|
|
|
];
|
2019-09-26 23:49:58 +00:00
|
|
|
}
|
2022-09-30 10:20:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add the oEmbed loading attribute setting to field formatter instances.
|
|
|
|
*/
|
|
|
|
function media_post_update_oembed_loading_attribute(array &$sandbox = NULL): void {
|
|
|
|
$media_config_updater = \Drupal::classResolver(MediaConfigUpdater::class);
|
|
|
|
assert($media_config_updater instanceof MediaConfigUpdater);
|
|
|
|
$media_config_updater->setDeprecationsEnabled(TRUE);
|
|
|
|
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'entity_view_display', function (EntityViewDisplayInterface $view_display) use ($media_config_updater): bool {
|
|
|
|
return $media_config_updater->processOembedEagerLoadField($view_display);
|
|
|
|
});
|
|
|
|
}
|