示例#1
0
 /**
  * @param \Drupal\scheduled_updates\ScheduledUpdateTypeInterface $scheduledUpdateType
  *
  * @param $types
  *
  * @return bool
  */
 public function updateSupportsTypes(ScheduledUpdateTypeInterface $scheduledUpdateType, $types) {
   $plugin_id = $scheduledUpdateType->getUpdateRunnerSettings()['id'];
   if ($this->runnerManager->hasDefinition($plugin_id)) {
     $definition = $this->runnerManager->getDefinition($plugin_id);
     $unsupported_types = array_diff($types, $definition['update_types']);
     return empty($unsupported_types);
   }
   return FALSE;
 }
 /**
  * @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;
 }
 /**
  * Get definitions for Runner Plugins that should be supported.
  *
  * @return array|\mixed[]|null
  */
 protected function getSupportedRunnerDefinitions() {
   return $this->runnerManager->getDefinitions();
 }