protected function ContentModelUpdater::swapEmbedFieldDisplay in Panopoly 8.2
Swap embed field in form/view mode display config.
Parameters
array $config: Configuration array.
string $type: The type of display config, 'form' or 'view'. Defaults to 'view'.
Return value
array The display config with video embed field swapped-out for oembed field.
2 calls to ContentModelUpdater::swapEmbedFieldDisplay()
- ContentModelUpdater::installFormDisplays in modules/
panopoly/ panopoly_media/ src/ Update/ ContentModelUpdater.php - Install form displays.
- ContentModelUpdater::installViewDisplays in modules/
panopoly/ panopoly_media/ src/ Update/ ContentModelUpdater.php - Install view displays.
File
- modules/
panopoly/ panopoly_media/ src/ Update/ ContentModelUpdater.php, line 715
Class
- ContentModelUpdater
- Applies changes to media content model from schema versions 8204 to 8205.
Namespace
Drupal\panopoly_media\UpdateCode
protected function swapEmbedFieldDisplay(array $config, $type = 'view') {
// Field displayed in content.
if (array_key_exists('field_media_video_embed_field', $config['content'])) {
switch ($type) {
case 'form':
$config['content']['field_media_oembed_video'] = $this
->adaptVideoFormDisplayConfig($config['content']['field_media_video_embed_field']);
break;
default:
$config['content']['field_media_oembed_video'] = $this
->adaptVideoViewDisplayConfig($config['content']['field_media_video_embed_field']);
}
unset($config['content']['field_media_video_embed_field']);
ksort($config['content']);
}
// Hidden field.
if (array_key_exists('field_media_video_embed_field', $config['hidden'])) {
$config['hidden']['field_media_oembed_video'] = $config['hidden']['field_media_video_embed_field'];
unset($config['hidden']['field_media_video_embed_field']);
ksort($config['hidden']);
}
return $config;
}