Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 26 |
| EditForm | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
30 | |
0.00% |
0 / 26 |
| getFormId | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| buildPath | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| buildForm | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 13 |
|||
| deleteSubmit | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 9 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\path\Form\EditForm. | |
| */ | |
| namespace Drupal\path\Form; | |
| use Drupal\Core\Form\FormStateInterface; | |
| use Drupal\Core\Url; | |
| /** | |
| * Provides the path edit form. | |
| */ | |
| class EditForm extends PathFormBase { | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getFormId() { | |
| return 'path_admin_edit'; | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| protected function buildPath($pid) { | |
| return $this->aliasStorage->load(array('pid' => $pid)); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function buildForm(array $form, FormStateInterface $form_state, $pid = NULL) { | |
| $form = parent::buildForm($form, $form_state, $pid); | |
| $form['#title'] = $this->path['alias']; | |
| $form['pid'] = array( | |
| '#type' => 'hidden', | |
| '#value' => $this->path['pid'], | |
| ); | |
| $form['actions']['delete'] = array( | |
| '#type' => 'submit', | |
| '#value' => $this->t('Delete'), | |
| '#submit' => array('::deleteSubmit'), | |
| ); | |
| return $form; | |
| } | |
| /** | |
| * Submits the delete form. | |
| */ | |
| public function deleteSubmit(array &$form, FormStateInterface $form_state) { | |
| $url = new Url('path.delete', array( | |
| 'pid' => $form_state->getValue('pid'), | |
| )); | |
| if ($this->getRequest()->query->has('destination')) { | |
| $url->setOption('query', $this->getDestinationArray()); | |
| $this->getRequest()->query->remove('destination'); | |
| } | |
| $form_state->setRedirectUrl($url); | |
| } | |
| } |