ViewMode.php in Drupal 10
File
core/modules/field/src/Plugin/migrate/source/d7/ViewMode.php
View source
<?php
namespace Drupal\field\Plugin\migrate\source\d7;
class ViewMode extends FieldInstance {
protected function initializeIterator() {
$instances = parent::initializeIterator();
$rows = [];
foreach ($instances
->getArrayCopy() as $instance) {
$data = unserialize($instance['data']);
foreach (array_keys($data['display']) as $view_mode) {
$key = $instance['entity_type'] . '.' . $view_mode;
$rows[$key] = array_merge($instance, [
'view_mode' => $view_mode,
]);
}
}
return new \ArrayIterator($rows);
}
public function fields() {
return array_merge(parent::fields(), [
'view_mode' => $this
->t('The view mode ID.'),
]);
}
public function getIds() {
return [
'entity_type' => [
'type' => 'string',
],
'view_mode' => [
'type' => 'string',
],
];
}
}
Classes
Name |
Description |
ViewMode |
Drupal 7 view mode source from database. |