RemoteVideoBase.php in Media Migration 8
File
src/Plugin/media_migration/file_entity/RemoteVideoBase.php
View source
<?php
namespace Drupal\media_migration\Plugin\media_migration\file_entity;
use Drupal\Core\Database\Connection;
use Drupal\media_migration\FileEntityDealerBase;
use Drupal\migrate\Row;
abstract class RemoteVideoBase extends FileEntityDealerBase {
public function getDestinationMediaTypeIdBase() {
return 'remote_video';
}
public function getDestinationMediaTypeId() {
return $this
->getDestinationMediaTypeIdBase();
}
public function getDestinationMediaTypeSourceFieldLabel() {
return 'Video URL';
}
public function getDestinationMediaTypeLabel() {
return 'Remote video';
}
public function getDestinationMediaSourceFieldName() {
return 'field_media_oembed_video';
}
public function alterMediaEntityMigrationDefinition(array &$migration_definition, Connection $connection) : void {
$migration_definition['process'][$this
->getDestinationMediaSourceFieldName() . '/value'] = [
'plugin' => 'media_internet_field_value',
'source' => 'uri',
];
}
public function prepareMediaSourceFieldFormatterRow(Row $row, Connection $connection) : void {
parent::prepareMediaSourceFieldFormatterRow($row, $connection);
$options = [
'type' => 'oembed',
] + $row
->getSourceProperty('options') ?? [];
$row
->setSourceProperty('options', $options);
}
}
Classes
Name |
Description |
RemoteVideoBase |
Abstract plugin class for remote video media migration source plugins. |