You are here

protected function ScheduledUpdateTypeBaseForm::createRunnerInstance in Scheduled Updates 8

Create an instance of the Runner plugin to be used with this Update Type.

Parameters

$runner_settings:

\Drupal\Core\Form\FormStateInterface $form_state:

Return value

\Drupal\scheduled_updates\Plugin\UpdateRunnerInterface

2 calls to ScheduledUpdateTypeBaseForm::createRunnerInstance()
ScheduledUpdateTypeBaseForm::createRunnerElements in src/Form/ScheduledUpdateTypeBaseForm.php
Create form elements for runner selection and options.
ScheduledUpdateTypeForm::validateForm in src/Form/ScheduledUpdateTypeForm.php
Form validation handler.

File

src/Form/ScheduledUpdateTypeBaseForm.php, line 501
Contains \Drupal\scheduled_updates\Form\ScheduledUpdateTypeBaseForm.

Class

ScheduledUpdateTypeBaseForm

Namespace

Drupal\scheduled_updates\Form

Code

protected function createRunnerInstance(&$runner_settings, FormStateInterface $form_state) {
  if (empty($runner_settings)) {
    $runner_settings = $this->entity
      ->getUpdateRunnerSettings();
  }
  if (!$this->runnerManager
    ->hasDefinition($runner_settings['id'])) {

    // Settings is using plugin which no longer exists.
    $runner_settings = [
      'id' => 'default_embedded',
    ];
  }

  /** @var UpdateRunnerInterface $update_runner */
  $update_runner = $this->runnerManager
    ->createInstance($runner_settings['id'], $runner_settings);
  $form_state
    ->set('update_runner', $runner_settings);
  $form_state
    ->set('scheduled_update_type', $this->entity);
  return $update_runner;
}