protected function runnerSupportsEmbedded($settings) { if ($this->runnerManager->hasDefinition($settings['id'])) { $definition = $this->runnerManager->getDefinition($settings['id']); return in_array('embedded', $definition['update_types']); } return FALSE; }
/** * @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; }
/** * Save the entity on submit. * * @param array $form * @param \Drupal\Core\Form\FormStateInterface $form_state * * @return int */ public function doSave(array $form, FormStateInterface $form_state) { $definition = $this->runnerManager->getDefinition($this->entity->getUpdateRunnerSettings()['id']); $this->entity->setUpdateTypesSupported($definition['update_types']); $status = $this->entity->save(); if ($status == SAVED_NEW) { drupal_set_message($this->t('Created the %label Scheduled Update Type.', [ '%label' => $this->entity->label(), ])); if (in_array('embedded',$this->entity->getUpdateTypesSupported())) { if ($form_state->getValue('reference_settings')) { $this->setUpFieldReferences($form_state); } } } return $status; }