/**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     $entity = $this->entity;
     $status = $entity->save();
     switch ($status) {
         case SAVED_NEW:
             drupal_set_message($this->t('Created %label.', ['%label' => $entity->label()]));
             $form_state->setRedirectUrl($entity->toUrl('edit-form'));
             break;
         default:
             drupal_set_message($this->t('Saved %label.', ['%label' => $entity->label()]));
             $form_state->setRedirectUrl($entity->toUrl('collection'));
             break;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $component = $this->rulesUiHandler->getComponent();
     $component->getExpression()->deleteExpression($this->uuid);
     $this->rulesUiHandler->updateComponent($component);
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->page->removeAccessCondition($this->accessCondition->getConfiguration()['uuid']);
     $this->page->save();
     drupal_set_message($this->t('The access condition %name has been removed.', ['%name' => $this->accessCondition->getPluginDefinition()['label']]));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     $this->logger('user')->notice('Role %name has been deleted.', array('%name' => $this->entity->label()));
     drupal_set_message($this->t('Role %name has been deleted.', array('%name' => $this->entity->label())));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->page->removeVariant($this->displayVariant->id());
     $this->page->save();
     drupal_set_message($this->t('The display variant %name has been removed.', ['%name' => $this->displayVariant->label()]));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     drupal_set_message(t('Custom block type %label has been deleted.', array('%label' => $this->entity->label())));
     $this->logger('block_content')->notice('Custom block type %label has been deleted.', array('%label' => $this->entity->label()));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->getEntity()->delete();
     $this->logger->info('Payment status %label (@id) has been deleted.', ['@id' => $this->getEntity()->id(), '%label' => $this->getEntity()->label()]);
     drupal_set_message($this->t('%label has been deleted.', array('%label' => $this->getEntity()->label())));
     $form_state->setRedirectUrl($this->getEntity()->urlInfo('collection'));
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     \Drupal::service('router.builder')->setRebuildNeeded();
     drupal_set_message($this->t('Signup Form %label has been deleted.', array('%label' => $this->entity->label())));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $currency_locale = $this->getEntity();
     $currency_locale->delete();
     drupal_set_message($this->t('The currency locale %label has been deleted.', array('%label' => $currency_locale->label())));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     drupal_set_message($this->t('Deleted vocabulary %name.', array('%name' => $this->entity->label())));
     $this->logger('taxonomy')->notice('Deleted vocabulary %name.', array('%name' => $this->entity->label()));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     if (mailchimp_campaign_delete_campaign($this->entity)) {
         drupal_set_message($this->t('MailChimp Campaign %label has been deleted.', array('%label' => $this->entity->label())));
     }
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     $this->termStorage->resetWeights($this->entity->id());
     drupal_set_message($this->t('Reset vocabulary %name to alphabetical order.', array('%name' => $this->entity->label())));
     $this->logger('taxonomy')->notice('Reset vocabulary %name to alphabetical order.', array('%name' => $this->entity->label()));
     $form_state->setRedirectUrl($this->entity->urlInfo('edit-form'));
 }
Example #13
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $entity = $this->getEntity();
     $entity->delete();
     \Drupal::logger('eck')->notice('@type: deleted %title.', array('@type' => $this->entity->bundle(), '%title' => $this->entity->label()));
     $form_state->setRedirectUrl(new Url('eck.entity.' . $this->entity->getEntityTypeId() . '.list'));
 }
  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    // Handle current blocks according to user's selection.
    if ($blocks = $this->getBlocksForGroup()) {
      $blocks_op = $form_state->getValue('blocks_op');
      switch ($blocks_op) {
        case static::DELETE_BLOCKS:
          $this->blockStorage()->delete($blocks);
          break;

        case static::UNSET_BLOCKS:
          $this->setBlocksGroup($blocks);
          break;

        default:
          $this->setBlocksGroup($blocks, $blocks_op);
      }
    }
    $this->entity->delete();

    drupal_set_message(
      $this->t('Deleted @type:  @label.',
        [
          '@type' => $this->entity->getEntityType()->getLabel(),
          '@label' => $this->entity->label(),
        ]
      )
    );

    $form_state->setRedirectUrl($this->getCancelUrl());
  }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->entity->set('replacementID', $form_state->getValue('replacement'));
     $this->entity->delete();
     drupal_set_message($this->t('Style %name was deleted.', array('%name' => $this->entity->label())));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $formState)
 {
     $this->entity->delete();
     drupal_set_message($this->t('The empty page callback for %title has been deleted.', array('%title' => $this->entity->getTitle())));
     $this->emptyPageManager->rebuildRoutes();
     $formState->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     $this->logger('user')->notice('Deleted action %aid (%action)', array('%aid' => $this->entity->id(), '%action' => $this->entity->label()));
     drupal_set_message($this->t('Action %action was deleted', array('%action' => $this->entity->label())));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $_SESSION['dblog_overview_filter'] = array();
     $this->connection->delete('watchdog')->execute();
     drupal_set_message($this->t('Database log cleared.'));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state) {
   // Save the default disabled form message.
   $this->entity->setThirdPartySetting('contact_storage', 'disabled_form_message', $form_state->getValue('contact_storage_disabled_form_message'));
   $this->entity->disable()->save();
   drupal_set_message($this->t('Disabled contact form %form.', ['%form' => $this->entity->label()]));
   $form_state->setRedirectUrl($this->getCancelUrl());
 }
Example #20
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     drupal_set_message($this->t('Domain %label has been deleted.', array('%label' => $this->entity->label())));
     \Drupal::logger('domain')->notice('Domain %label has been deleted.', array('%label' => $this->entity->label()));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     $this->logger('sample_config_entity')->notice('Ball %name has been deleted.', array('%name' => $this->entity->label()));
     drupal_set_message($this->t('Ball %name has been deleted.', array('%name' => $this->entity->label())));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
Example #22
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     /** @var \Drupal\tmgmt\Entity\Job $entity */
     $entity = $this->entity;
     if (!$entity->abortTranslation()) {
         // This is the case when a translator does not support the abort
         // operation.
         // It would make more sense to not display the button for the action,
         // however we do not know if the translator is able to abort a job until
         // we trigger the action.
         foreach ($entity->getMessagesSince() as $message) {
             /** @var \Drupal\tmgmt\MessageInterface $message */
             if ($message->getType() == 'debug') {
                 continue;
             }
             if ($text = $message->getMessage()) {
                 // We want to persist also the type therefore we will set the
                 // messages directly and not return them.
                 drupal_set_message($text, $message->getType());
             }
         }
     } else {
         $entity->addMessage('The user ordered aborting the Job through the UI.');
     }
     tmgmt_write_request_messages($entity);
     $form_state->setRedirectUrl($this->entity->toUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     drupal_set_message($this->t('The static context %label has been removed.', ['%label' => $this->page->getStaticContext($this->staticContext)['label']]));
     $this->page->removeStaticContext($this->staticContext);
     $this->page->save();
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     drupal_set_message($this->t('Deleted contact message %subject.', array('%subject' => $this->entity->getSubject())));
     $this->logger('contact_storage')->notice('Deleted contact message %subject.', array('%subject' => $this->entity->getSubject()));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
Example #25
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     /* @var $entity \Drupal\quiz\Entity\Quiz */
     /* @var $question \Drupal\quiz\Entity\Question */
     /* @var $answer \Drupal\quiz\Entity\Answer */
     /* @var $state \Drupal\quiz\Entity\UserQuizStatus */
     $entity = $this->entity;
     $questions = $entity->getQuestions();
     $answerCount = 0;
     $questionCount = 0;
     $stateCount = 0;
     foreach ($questions as $question) {
         $answers = $question->getAnswers();
         foreach ($answers as $answer) {
             $answerCount++;
             $answer->delete();
         }
         $questionCount++;
         $question->delete();
     }
     $states = $entity->getStatuses();
     foreach ($states as $state) {
         $stateCount++;
         $state->delete();
     }
     $this->entity->delete();
     drupal_set_message($this->t('Deleted Quiz @label, @answers answers, @questions questions and @states quiz attempts.', ['@label' => $this->entity->label(), '@answers' => $answerCount, '@questions' => $questionCount, '@states' => $stateCount]));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->getVariantPlugin()->removeBlock($this->block->getConfiguration()['uuid']);
     $this->pageVariant->save();
     drupal_set_message($this->t('The block %label has been removed.', ['%label' => $this->block->label()]));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
Example #27
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->taxonomyTerm->delete();
     drupal_set_message($this->t('The forum %label and all sub-forums have been deleted.', array('%label' => $this->taxonomyTerm->label())));
     $this->logger('forum')->notice('forum: deleted %label and all its sub-forums.', array('%label' => $this->taxonomyTerm->label()));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
Example #28
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Delete and set message
     $this->entity->delete();
     drupal_set_message($this->t('The demo @name has been deleted.', array('@name' => $this->entity->name)));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * {@inheritdoc}
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     drupal_set_message($this->t('Responsive image mapping %label has been deleted.', array('%label' => $this->entity->label())));
     $this->logger('responsive_image')->notice('Responsive image mapping %label has been deleted.', array('%label' => $this->entity->label()));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
Example #30
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $document = array('#type' => 'texgen_document', '#texgenformdata' => $form_state->getValues());
     global $_SESSION;
     $_SESSION['texgen']['result'] = \Drupal::service('renderer')->render($document);
     $form_state->setRedirectUrl(Url::fromRoute('texgen.page'));
 }