MessageTemplateProcessText.php in Message 8
File
src/Plugin/migrate/process/MessageTemplateProcessText.php
View source
<?php
namespace Drupal\message\Plugin\migrate\process;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
class MessageTemplateProcessText extends ProcessPluginBase {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$source = $row
->getSource();
$message_tpl = \Drupal::entityTypeManager()
->getStorage('message_template')
->load($row
->getSource()['name']);
$texts = [];
if (!empty($message_tpl)) {
$texts = $message_tpl
->getRawText();
}
$texts[] = [
'value' => $source['message_text_value'],
'format' => $source['message_text_format'],
];
return $texts;
}
}