projects
/
yaffs-website
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Security update for Core, with self-updated composer
[yaffs-website]
/
web
/
core
/
modules
/
field
/
src
/
Plugin
/
migrate
/
source
/
d7
/
ViewMode.php
diff --git
a/web/core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php
b/web/core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php
index 3dd037c9bf716d0bff77e29d8c2704e8fd344e95..039960a4ed5b9ef1dd4533b9afd6922da1935a45 100644
(file)
--- a/
web/core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php
+++ b/
web/core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php
@@
-2,31
+2,33
@@
namespace Drupal\field\Plugin\migrate\source\d7;
namespace Drupal\field\Plugin\migrate\source\d7;
-use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
-
/**
/**
+ * The view mode source class.
+ *
* @MigrateSource(
* @MigrateSource(
- * id = "d7_view_mode"
+ * id = "d7_view_mode",
+ * source_module = "field"
* )
*/
* )
*/
-class ViewMode extends
DrupalSqlBas
e {
+class ViewMode extends
FieldInstanc
e {
/**
* {@inheritdoc}
*/
protected function initializeIterator() {
/**
* {@inheritdoc}
*/
protected function initializeIterator() {
+ $instances = parent::initializeIterator();
+
$rows = [];
$rows = [];
- $result = $this->prepareQuery()->execute();
- foreach ($result as $field_instance) {
- $data = unserialize($field_instance['data']);
+ foreach ($instances->getArrayCopy() as $instance) {
+ $data = unserialize($instance['data']);
foreach (array_keys($data['display']) as $view_mode) {
foreach (array_keys($data['display']) as $view_mode) {
- $key = $field_instance['entity_type'] . '.' . $view_mode;
- $rows[$key] = [
- 'entity_type' => $field_instance['entity_type'],
+ $key = $instance['entity_type'] . '.' . $view_mode;
+ $rows[$key] = array_merge($instance, [
'view_mode' => $view_mode,
'view_mode' => $view_mode,
- ];
+ ]
)
;
}
}
}
}
+
return new \ArrayIterator($rows);
}
return new \ArrayIterator($rows);
}
@@
-34,18
+36,9
@@
class ViewMode extends DrupalSqlBase {
* {@inheritdoc}
*/
public function fields() {
* {@inheritdoc}
*/
public function fields() {
- return [
+ return
array_merge(parent::fields(),
[
'view_mode' => $this->t('The view mode ID.'),
'view_mode' => $this->t('The view mode ID.'),
- 'entity_type' => $this->t('The entity type ID.'),
- ];
- }
-
- /**
- * {@inheritdoc}
- */
- public function query() {
- return $this->select('field_config_instance', 'fci')
- ->fields('fci', ['entity_type', 'data']);
+ ]);
}
/**
}
/**
@@
-62,11
+55,4
@@
class ViewMode extends DrupalSqlBase {
];
}
];
}
- /**
- * {@inheritdoc}
- */
- public function count() {
- return $this->initializeIterator()->count();
- }
-
}
}