3 namespace Drupal\field\Plugin\migrate\source\d6;
5 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
8 * The field instance per form display source class.
11 * id = "d6_field_instance_per_form_display",
12 * source_provider = "content"
15 class FieldInstancePerFormDisplay extends DrupalSqlBase {
20 protected function initializeIterator() {
22 $result = $this->prepareQuery()->execute();
23 while ($field_row = $result->fetchAssoc()) {
24 $bundle = $field_row['type_name'];
25 $field_name = $field_row['field_name'];
27 $index = "$bundle.$field_name";
28 $rows[$index]['type_name'] = $bundle;
29 $rows[$index]['widget_active'] = (bool) $field_row['widget_active'];
30 $rows[$index]['field_name'] = $field_name;
31 $rows[$index]['type'] = $field_row['type'];
32 $rows[$index]['module'] = $field_row['module'];
33 $rows[$index]['weight'] = $field_row['weight'];
34 $rows[$index]['widget_type'] = $field_row['widget_type'];
35 $rows[$index]['widget_settings'] = unserialize($field_row['widget_settings']);
36 $rows[$index]['display_settings'] = unserialize($field_row['display_settings']);
39 return new \ArrayIterator($rows);
45 public function query() {
46 $query = $this->select('content_node_field_instance', 'cnfi')
63 $query->join('content_node_field', 'cnf', 'cnfi.field_name = cnf.field_name');
64 $query->orderBy('cnfi.weight');
72 public function fields() {
74 'field_name' => $this->t('The machine name of field.'),
75 'type_name' => $this->t('Content type where this field is used.'),
76 'weight' => $this->t('Weight.'),
77 'label' => $this->t('A name to show.'),
78 'widget_type' => $this->t('Widget type.'),
79 'widget_settings' => $this->t('Serialize data with widget settings.'),
80 'display_settings' => $this->t('Serialize data with display settings.'),
81 'description' => $this->t('A description of field.'),
82 'widget_module' => $this->t('Module that implements widget.'),
83 'widget_active' => $this->t('Status of widget'),
90 public function getIds() {
91 $ids['type_name']['type'] = 'string';
92 $ids['field_name']['type'] = 'string';