function lightning_media_update_8013 in Lightning Media 8.2
Same name and namespace in other branches
- 8.4 lightning_media.install \lightning_media_update_8013()
- 8 lightning_media.install \lightning_media_update_8013()
- 8.3 lightning_media.install \lightning_media_update_8013()
Adds the media.embedded view display to the media_browser embed button.
1 call to lightning_media_update_8013()
- lightning_media_install in ./
lightning_media.install - Implements hook_install().
File
- ./
lightning_media.install, line 218 - Contains install and update routines for Lightning Media.
Code
function lightning_media_update_8013() {
$button = EmbedButton::load('media_browser');
if ($button) {
// During installation, the media.embedded view mode may have just been
// created as part of this module's default configuration. So we need to
// clear Entity Embed's display plugin definition cache to ensure that it
// picks up the new view mode's corresponding display plugin.
\Drupal::service('plugin.manager.entity_embed.display')
->clearCachedDefinitions();
$type_settings = $button
->getTypeSettings();
$type_settings['display_plugins'][] = 'view_mode:media.embedded';
$button
->set('type_settings', $type_settings);
$button
->save();
}
}