/** * Get the Runner Plugin Instance for a Type. * @param \Drupal\scheduled_updates\ScheduledUpdateTypeInterface $scheduledUpdateType * * @return null|object */ public function getUpdateRunnerInstance(ScheduledUpdateTypeInterface $scheduledUpdateType) { $runner_settings = $scheduledUpdateType->getUpdateRunnerSettings(); $runner_settings['updater_type'] = $scheduledUpdateType->id(); if ($this->runnerManager->hasDefinition($runner_settings['id'])) { return $this->runnerManager->createInstance($runner_settings['id'], $runner_settings); } return NULL; }
/** * @param $runner_settings * * @return UpdateRunnerInterface */ 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; }