X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffield%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd7%2FField.php;fp=web%2Fcore%2Fmodules%2Ffield%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd7%2FField.php;h=9e92619f8e7819c9f7678821b159481405e8d24f;hp=d9aef9162a69760b9567901d26f4c1f2f638b5b7;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/field/src/Plugin/migrate/source/d7/Field.php b/web/core/modules/field/src/Plugin/migrate/source/d7/Field.php index d9aef9162..9e92619f8 100644 --- a/web/core/modules/field/src/Plugin/migrate/source/d7/Field.php +++ b/web/core/modules/field/src/Plugin/migrate/source/d7/Field.php @@ -8,8 +8,14 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; /** * Drupal 7 field source from database. * + * @internal + * + * This class is marked as internal and should not be extended. Use + * Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase instead. + * * @MigrateSource( - * id = "d7_field" + * id = "d7_field", + * source_module = "field" * ) */ class Field extends DrupalSqlBase { @@ -23,8 +29,9 @@ class Field extends DrupalSqlBase { ->fields('fc') ->fields('fci', ['entity_type']) ->condition('fc.active', 1) + ->condition('fc.storage_active', 1) ->condition('fc.deleted', 0) - ->condition('fc.storage_active', 1); + ->condition('fci.deleted', 0); $query->join('field_config_instance', 'fci', 'fc.id = fci.field_id'); return $query; @@ -35,13 +42,20 @@ class Field extends DrupalSqlBase { */ public function fields() { return [ - 'field_name' => $this->t('The name of this field.'), - 'type' => $this->t('The type of this field.'), + 'id' => $this->t('The field ID.'), + 'field_name' => $this->t('The field name.'), + 'type' => $this->t('The field type.'), 'module' => $this->t('The module that implements the field type.'), - 'storage' => $this->t('The field storage.'), + 'active' => $this->t('The field status.'), + 'storage_type' => $this->t('The field storage type.'), + 'storage_module' => $this->t('The module that implements the field storage type.'), + 'storage_active' => $this->t('The field storage status.'), 'locked' => $this->t('Locked'), + 'data' => $this->t('The field data.'), 'cardinality' => $this->t('Cardinality'), 'translatable' => $this->t('Translatable'), + 'deleted' => $this->t('Deleted'), + 'instances' => $this->t('The field instances.'), ]; } @@ -52,6 +66,15 @@ class Field extends DrupalSqlBase { foreach (unserialize($row->getSourceProperty('data')) as $key => $value) { $row->setSourceProperty($key, $value); } + + $instances = $this->select('field_config_instance', 'fci') + ->fields('fci') + ->condition('field_name', $row->getSourceProperty('field_name')) + ->condition('entity_type', $row->getSourceProperty('entity_type')) + ->execute() + ->fetchAll(); + $row->setSourceProperty('instances', $instances); + return parent::prepareRow($row); }