Mercurial > hg > isophonics-drupal-site
comparison modules/contrib/migrate_tools/src/Form/MigrationEditForm.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\migrate_tools\Form; | |
4 | |
5 use Drupal\Core\Form\FormStateInterface; | |
6 use Drupal\Core\Url; | |
7 | |
8 /** | |
9 * Class MigrationEditForm | |
10 * | |
11 * Provides the edit form for our Migration entity. | |
12 * | |
13 * @package Drupal\migrate_tools\Form | |
14 * | |
15 * @ingroup migrate_tools | |
16 */ | |
17 class MigrationEditForm extends MigrationFormBase { | |
18 | |
19 /** | |
20 * Returns the actions provided by this form. | |
21 * | |
22 * For the edit form, we only need to change the text of the submit button. | |
23 * | |
24 * @param array $form | |
25 * An associative array containing the structure of the form. | |
26 * @param \Drupal\Core\Form\FormStateInterface $form_state | |
27 * An associative array containing the current state of the form. | |
28 * | |
29 * @return array | |
30 * An array of supported actions for the current entity form. | |
31 */ | |
32 public function actions(array $form, FormStateInterface $form_state) { | |
33 $actions = parent::actions($form, $form_state); | |
34 $actions['submit']['#value'] = t('Update Migration'); | |
35 | |
36 // Add the group parameter to the delete URL. | |
37 $this->addGroupParameter($actions['delete']['#url'], $this->getEntity()->get('migration_group')); | |
38 | |
39 return $actions; | |
40 } | |
41 | |
42 /** | |
43 * @param \Drupal\Core\Url $url | |
44 * The URL associated with an operation. | |
45 * | |
46 * @param $migration_group | |
47 * The migration's parent group. | |
48 */ | |
49 protected function addGroupParameter(Url $url, $migration_group) { | |
50 $route_parameters = $url->getRouteParameters() + array('migration_group' => $migration_group); | |
51 $url->setRouteParameters($route_parameters); | |
52 } | |
53 | |
54 } |