summaryrefslogtreecommitdiff
path: root/modules/path
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-01-21 04:20:08 +0000
committerDries Buytaert <dries@buytaert.net>2010-01-21 04:20:08 +0000
commitb4a8b14642ae3d5a33d6124b24212f1e446ea74a (patch)
treeedc5c9c5dd13a4c3a3e6f9fa9194b0aa91e14301 /modules/path
parent1f7aa072224f18eef87bf12b8f79f08ac333e222 (diff)
downloadbrdo-b4a8b14642ae3d5a33d6124b24212f1e446ea74a.tar.gz
brdo-b4a8b14642ae3d5a33d6124b24212f1e446ea74a.tar.bz2
- Patch #689738 by c960657: use Save and Delete buttons on path alias editing form.
Diffstat (limited to 'modules/path')
-rw-r--r--modules/path/path.admin.inc32
-rw-r--r--modules/path/path.test11
2 files changed, 29 insertions, 14 deletions
diff --git a/modules/path/path.admin.inc b/modules/path/path.admin.inc
index e4f971720..bb31d1bfd 100644
--- a/modules/path/path.admin.inc
+++ b/modules/path/path.admin.inc
@@ -121,26 +121,41 @@ function path_admin_form($form, &$form_state, $path = array('source' => '', 'ali
'#type' => 'value',
'#value' => $path['language']
);
+
+ $form['actions'] = array(
+ '#type' => 'container',
+ '#attributes' => array('class' => array('form-actions')),
+ );
+ $form['actions']['submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Save'),
+ );
if ($path['pid']) {
$form['pid'] = array(
'#type' => 'hidden',
'#value' => $path['pid'],
);
- $form['submit'] = array(
+ $form['actions']['delete'] = array(
'#type' => 'submit',
- '#value' => t('Update alias'),
- );
- }
- else {
- $form['submit'] = array(
- '#type' => 'submit',
- '#value' => t('Create new alias'),
+ '#value' => t('Delete'),
+ '#submit' => array('path_admin_form_delete_submit'),
);
}
return $form;
}
+/**
+ * Submit function for the 'Delete' button on the URL alias editing form.
+ */
+function path_admin_form_delete_submit($form, &$form_state) {
+ $destination = array();
+ if (isset($_GET['destination'])) {
+ $destination = drupal_get_destination();
+ unset($_GET['destination']);
+ }
+ $form_state['redirect'] = array('admin/config/search/path/delete/' . $form_state['values']['pid'], array('query' => $destination));
+}
/**
* Verify that a URL alias is valid
@@ -207,7 +222,6 @@ function path_admin_delete_confirm_submit($form, &$form_state) {
}
}
-
/**
* Return a form to filter URL aliases.
*
diff --git a/modules/path/path.test b/modules/path/path.test
index 15053ec39..baba8e864 100644
--- a/modules/path/path.test
+++ b/modules/path/path.test
@@ -34,7 +34,7 @@ class PathTestCase extends DrupalWebTestCase {
$edit = array();
$edit['source'] = 'node/' . $node1->nid;
$edit['alias'] = $this->randomName(8);
- $this->drupalPost('admin/config/search/path/add', $edit, t('Create new alias'));
+ $this->drupalPost('admin/config/search/path/add', $edit, t('Save'));
// Visit the system path for the node and confirm a cache entry is
// created.
@@ -59,7 +59,7 @@ class PathTestCase extends DrupalWebTestCase {
$edit = array();
$edit['source'] = 'node/' . $node1->nid;
$edit['alias'] = $this->randomName(8);
- $this->drupalPost('admin/config/search/path/add', $edit, t('Create new alias'));
+ $this->drupalPost('admin/config/search/path/add', $edit, t('Save'));
// Confirm that the alias works.
$this->drupalGet($edit['alias']);
@@ -71,7 +71,7 @@ class PathTestCase extends DrupalWebTestCase {
$previous = $edit['alias'];
$edit['alias'] = $this->randomName(8);
- $this->drupalPost('admin/config/search/path/edit/' . $pid, $edit, t('Update alias'));
+ $this->drupalPost('admin/config/search/path/edit/' . $pid, $edit, t('Save'));
// Confirm that the alias works.
$this->drupalGet($edit['alias']);
@@ -90,13 +90,14 @@ class PathTestCase extends DrupalWebTestCase {
// Set alias to second test node.
$edit['source'] = 'node/' . $node2->nid;
// leave $edit['alias'] the same
- $this->drupalPost('admin/config/search/path/add', $edit, t('Create new alias'));
+ $this->drupalPost('admin/config/search/path/add', $edit, t('Save'));
// Confirm no duplicate was created.
$this->assertRaw(t('The alias %alias is already in use in this language.', array('%alias' => $edit['alias'])), 'Attempt to move alias was rejected.');
// Delete alias.
- $this->drupalPost('admin/config/search/path/delete/' . $pid, array(), t('Confirm'));
+ $this->drupalPost('admin/config/search/path/edit/' . $pid, array(), t('Delete'));
+ $this->drupalPost(NULL, array(), t('Confirm'));
// Confirm that the alias no longer works.
$this->drupalGet($edit['alias']);