You are here

public function ImportWizard::getOperations in WordPress Migrate 8.3

Retrieve a list of FormInterface classes by their step key in the wizard.

Parameters

mixed $cached_values: The values returned by $this->getTempstore()->get($this->getMachineName()); *.

Return value

array An associative array keyed on the step name with an array value with the following keys:

  • title (string): Human-readable title of the step.
  • form (string): Fully-qualified class name of the form for this step.
  • values (array): Optional array of cached values to override when on this step.
  • validate (array): Optional array of callables to be called when this step is validated.
  • submit (array): Optional array of callables to be called when this step is submitted.

Overrides FormWizardInterface::getOperations

File

wordpress_migrate_ui/src/Wizard/ImportWizard.php, line 19

Class

ImportWizard
Imports the wizard.

Namespace

Drupal\wordpress_migrate_ui\Wizard

Code

public function getOperations($cached_values) {
  $steps = [
    'source_select' => [
      'form' => 'Drupal\\wordpress_migrate_ui\\Form\\SourceSelectForm',
      'title' => $this
        ->t('Data source'),
    ],
    'authors' => [
      'form' => 'Drupal\\wordpress_migrate_ui\\Form\\AuthorForm',
      'title' => $this
        ->t('Authors'),
    ],
    'vocabulary_select' => [
      'form' => 'Drupal\\wordpress_migrate_ui\\Form\\VocabularySelectForm',
      'title' => $this
        ->t('Vocabularies'),
    ],
    'content_select' => [
      'form' => 'Drupal\\wordpress_migrate_ui\\Form\\ContentSelectForm',
      'title' => $this
        ->t('Content'),
    ],
    'image_select' => [
      'form' => 'Drupal\\wordpress_migrate_ui\\Form\\ImageSelectForm',
      'title' => $this
        ->t('Featured images'),
    ],
  ];

  // Dynamically add the content migration(s) that have been configured by
  // ContentSelectForm.
  if (!empty($cached_values['post']['type'])) {
    $steps += [
      'blog_post' => [
        'form' => 'Drupal\\wordpress_migrate_ui\\Form\\ContentTypeForm',
        'title' => $this
          ->t('Posts'),
        'values' => [
          'wordpress_content_type' => 'post',
        ],
      ],
    ];
  }
  if (!empty($cached_values['page']['type'])) {
    $steps += [
      'page' => [
        'form' => 'Drupal\\wordpress_migrate_ui\\Form\\ContentTypeForm',
        'title' => $this
          ->t('Pages'),
        'values' => [
          'wordpress_content_type' => 'page',
        ],
      ],
    ];
  }
  $steps += [
    'review' => [
      'form' => 'Drupal\\wordpress_migrate_ui\\Form\\ReviewForm',
      'title' => $this
        ->t('Review'),
      'values' => [
        'wordpress_content_type' => '',
      ],
    ],
  ];
  return $steps;
}