You are here

protected function MediaViewMode::initializeIterator in Media Migration 8

File

src/Plugin/migrate/source/d7/MediaViewMode.php, line 18

Class

MediaViewMode
Drupal 7 media view mode source based on source database.

Namespace

Drupal\media_migration\Plugin\migrate\source\d7

Code

protected function initializeIterator() {
  $rows = [
    [
      'mode' => 'full',
      'label' => $this
        ->getMediaViewModeLabel('full'),
    ],
    [
      'mode' => 'preview',
      'label' => $this
        ->getMediaViewModeLabel('preview'),
    ],
    [
      'mode' => 'rss',
      'label' => $this
        ->getMediaViewModeLabel('rss'),
    ],
    [
      'mode' => 'teaser',
      'label' => $this
        ->getMediaViewModeLabel('teaser'),
    ],
  ];
  if ($this
    ->moduleExists('search')) {
    $rows[] = [
      'mode' => 'search_index',
      'label' => $this
        ->getMediaViewModeLabel('search_index'),
    ];
    $rows[] = [
      'mode' => 'search_result',
      'label' => $this
        ->getMediaViewModeLabel('search_result'),
    ];
  }
  if ($this
    ->moduleExists('media_wysiwyg')) {
    $rows[] = [
      'mode' => 'wysiwyg',
      'label' => $this
        ->getMediaViewModeLabel('wysiwyg'),
    ];
  }
  return new \ArrayIterator($rows);
}