ContentTranslationEnabledSetting.php in Drupal 10
File
core/modules/language/src/Plugin/migrate/process/ContentTranslationEnabledSetting.php
View source
<?php
namespace Drupal\language\Plugin\migrate\process;
use Drupal\migrate\MigrateException;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
class ContentTranslationEnabledSetting extends ProcessPluginBase {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!is_array($value)) {
throw new MigrateException('Input should be an array');
}
[
$language_content_type,
$entity_translation_entity_types,
$entity_type,
] = $value;
switch ($language_content_type) {
case 0:
$setting = NULL;
break;
case 1:
$setting = FALSE;
break;
case 2:
$setting = FALSE;
break;
case 4:
$setting = FALSE;
if (!empty($entity_translation_entity_types[$entity_type])) {
$setting = TRUE;
}
break;
default:
$setting = NULL;
break;
}
return $setting;
}
}