FieldInstanceWidgetInsertSettings.php in Insert 8.2
File
src/Plugin/migrate/process/FieldInstanceWidgetInsertSettings.php
View source
<?php
namespace Drupal\insert\Plugin\migrate\process;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
class FieldInstanceWidgetInsertSettings extends ProcessPluginBase {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
return $this
->getInsertSettings($value);
}
public function getInsertSettings(array $widget_settings) {
if (!isset($widget_settings['insert'])) {
return [];
}
$styles = [];
if ($widget_settings['insert']) {
foreach ($widget_settings['insert_styles'] as $style) {
$style = preg_replace('/^image_/', '', $style);
$styles[$style] = $style;
}
}
return [
'insert' => [
'styles' => $styles,
'default' => $widget_settings['insert_default'],
'class' => $widget_settings['insert_class'],
'width' => $widget_settings['insert_width'],
],
];
}
}