ContentTranslationDeleteForm.php 1.95 KB
 webchick committed Dec 03, 2013 1 2 3 4 5 6 7 8 9 10 ``````entity = \$this->getRouteMatch()->getParameter(\$entity_type_id); \$this->language = \$language; `````` webchick committed Dec 03, 2013 47 48 49 50 51 52 53 54 55 56 57 58 59 60 `````` return parent::buildForm(\$form, \$form_state); } /** * {@inheritdoc} */ public function getConfirmText() { return \$this->t('Delete'); } /** * {@inheritdoc} */ public function getQuestion() { `````` catch committed Oct 16, 2014 61 `````` return \$this->t('Are you sure you want to delete the @language translation of %label?', array('@language' => \$this->language->getName(), '%label' => \$this->entity->label())); `````` webchick committed Dec 03, 2013 62 63 64 65 66 `````` } /** * {@inheritdoc} */ `````` alexpott committed Jul 25, 2014 67 `````` public function getCancelUrl() { `````` webchick committed May 20, 2014 68 `````` return \$this->entity->urlInfo('drupal:content-translation-overview'); `````` webchick committed Dec 03, 2013 69 70 71 72 73 `````` } /** * {@inheritdoc} */ `````` 74 `````` public function submitForm(array &\$form, FormStateInterface \$form_state) { `````` webchick committed Dec 03, 2013 75 `````` // Remove the translated values. `````` alexpott committed Oct 05, 2014 76 `````` \$this->entity = \$this->entity->getUntranslated(); `````` catch committed Oct 13, 2014 77 `````` \$this->entity->removeTranslation(\$this->language->getId()); `````` webchick committed Dec 03, 2013 78 79 `````` \$this->entity->save(); `````` 80 `````` \$form_state->setRedirectUrl(\$this->getCancelUrl()); `````` webchick committed Dec 03, 2013 81 82 83 `````` } }``````