Esempio n. 1
0
 /**
  * Display message about updates.
  *
  * @param $update_count
  * @param $invalid_count
  */
 protected function displayMessage($update_count, $invalid_count) {
   $msg = $this->t('Updater @title complete. Results:', ['@title' => $this->scheduled_update_type->label()]);
   if ($update_count) {
     $msg .= ' ' . $this->t('@count update(s) were performed.', ['@count' => $update_count]);
   }
   else {
     $msg .= ' ' . $this->t('No updates were performed.');
   }
   if ($invalid_count) {
     $msg .= ' ' . $this->t('@count updates were invalid', ['@count' => $invalid_count]);
   }
   drupal_set_message($msg);
 }
  /**
   * 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;

  }