3 namespace Drupal\field\Plugin\migrate\process\d6;
5 use Drupal\migrate\MigrateExecutableInterface;
6 use Drupal\migrate\ProcessPluginBase;
7 use Drupal\migrate\Row;
10 * Get the field instance widget settings.
12 * @MigrateProcessPlugin(
13 * id = "field_instance_widget_settings"
16 class FieldInstanceWidgetSettings extends ProcessPluginBase {
21 * Get the field instance default/mapped widget settings.
23 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
24 list($widget_type, $widget_settings) = $value;
25 return $this->getSettings($widget_type, $widget_settings);
29 * Merge the default D8 and specified D6 settings for a widget type.
31 * @param string $widget_type
33 * @param array $widget_settings
34 * The widget settings from D6 for this widget.
37 * A valid array of settings.
39 public function getSettings($widget_type, $widget_settings) {
40 $progress = isset($widget_settings['progress_indicator']) ? $widget_settings['progress_indicator'] : 'throbber';
41 $size = isset($widget_settings['size']) ? $widget_settings['size'] : 60;
42 $rows = isset($widget_settings['rows']) ? $widget_settings['rows'] : 5;
56 'email_textfield' => [
60 'placeholder_url' => '',
61 'placeholder_title' => '',
63 'filefield_widget' => [
64 'progress_indicator' => $progress,
66 'imagefield_widget' => [
67 'progress_indicator' => $progress,
68 'preview_image_style' => 'thumbnail',
70 'optionwidgets_onoff' => [
71 'display_label' => FALSE,
73 'phone_textfield' => [
78 return isset($settings[$widget_type]) ? $settings[$widget_type] : [];