3 namespace Drupal\field\Plugin\migrate\source\d6;
5 use Drupal\migrate\Row;
6 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
9 * Drupal 6 field instances source from database.
12 * id = "d6_field_instance",
13 * source_provider = "content"
16 class FieldInstance extends DrupalSqlBase {
21 public function query() {
22 $query = $this->select('content_node_field_instance', 'cnfi')->fields('cnfi');
23 if (isset($this->configuration['node_type'])) {
24 $query->condition('cnfi.type_name', $this->configuration['node_type']);
26 $query->join('content_node_field', 'cnf', 'cnf.field_name = cnfi.field_name');
27 $query->fields('cnf');
35 public function fields() {
37 'field_name' => $this->t('The machine name of field.'),
38 'type_name' => $this->t('Content type where this field is in use.'),
39 'weight' => $this->t('Weight.'),
40 'label' => $this->t('A name to show.'),
41 'widget_type' => $this->t('Widget type.'),
42 'widget_settings' => $this->t('Serialize data with widget settings.'),
43 'display_settings' => $this->t('Serialize data with display settings.'),
44 'description' => $this->t('A description of field.'),
45 'widget_module' => $this->t('Module that implements widget.'),
46 'widget_active' => $this->t('Status of widget'),
47 'module' => $this->t('The module that provides the field.'),
54 public function prepareRow(Row $row) {
56 $widget_settings = unserialize($row->getSourceProperty('widget_settings'));
57 $display_settings = unserialize($row->getSourceProperty('display_settings'));
58 $global_settings = unserialize($row->getSourceProperty('global_settings'));
59 $row->setSourceProperty('widget_settings', $widget_settings);
60 $row->setSourceProperty('display_settings', $display_settings);
61 $row->setSourceProperty('global_settings', $global_settings);
62 return parent::prepareRow($row);
68 public function getIds() {