Issue #1939024 follow-up by tim.plunkett: Small clean-ups to code.
parent
eebd063734
commit
45c60ea028
|
@ -121,7 +121,7 @@ function action_admin_configure_submit($form, &$form_state) {
|
||||||
action_save($function, $form_state['values']['action_type'], $params, $form_state['values']['action_label'], $aid);
|
action_save($function, $form_state['values']['action_type'], $params, $form_state['values']['action_label'], $aid);
|
||||||
drupal_set_message(t('The action has been successfully saved.'));
|
drupal_set_message(t('The action has been successfully saved.'));
|
||||||
|
|
||||||
$form_state['redirect'] = 'admin/config/system/actions/manage';
|
$form_state['redirect'] = 'admin/config/system/actions';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +137,7 @@ function action_admin_delete_form($form, &$form_state, $action) {
|
||||||
);
|
);
|
||||||
return confirm_form($form,
|
return confirm_form($form,
|
||||||
t('Are you sure you want to delete the action %action?', array('%action' => $action->label)),
|
t('Are you sure you want to delete the action %action?', array('%action' => $action->label)),
|
||||||
'admin/config/system/actions/manage',
|
'admin/config/system/actions',
|
||||||
t('This cannot be undone.'),
|
t('This cannot be undone.'),
|
||||||
t('Delete'),
|
t('Delete'),
|
||||||
t('Cancel')
|
t('Cancel')
|
||||||
|
@ -153,7 +153,7 @@ function action_admin_delete_form_submit($form, &$form_state) {
|
||||||
action_delete($aid);
|
action_delete($aid);
|
||||||
watchdog('user', 'Deleted action %aid (%action)', array('%aid' => $aid, '%action' => $action->label));
|
watchdog('user', 'Deleted action %aid (%action)', array('%aid' => $aid, '%action' => $action->label));
|
||||||
drupal_set_message(t('Action %action was deleted', array('%action' => $action->label)));
|
drupal_set_message(t('Action %action was deleted', array('%action' => $action->label)));
|
||||||
$form_state['redirect'] = 'admin/config/system/actions/manage';
|
$form_state['redirect'] = 'admin/config/system/actions';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -66,7 +66,6 @@ function action_menu() {
|
||||||
'title' => 'Manage actions',
|
'title' => 'Manage actions',
|
||||||
'description' => 'Manage the actions defined for your site.',
|
'description' => 'Manage the actions defined for your site.',
|
||||||
'type' => MENU_DEFAULT_LOCAL_TASK,
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||||||
'route_name' => 'action_admin_manage',
|
|
||||||
);
|
);
|
||||||
$items['admin/config/system/actions/configure'] = array(
|
$items['admin/config/system/actions/configure'] = array(
|
||||||
'title' => 'Configure an advanced action',
|
'title' => 'Configure an advanced action',
|
||||||
|
@ -84,12 +83,6 @@ function action_menu() {
|
||||||
'access arguments' => array('administer actions'),
|
'access arguments' => array('administer actions'),
|
||||||
'file' => 'action.admin.inc',
|
'file' => 'action.admin.inc',
|
||||||
);
|
);
|
||||||
$items['admin/config/system/actions/orphan'] = array(
|
|
||||||
'title' => 'Remove orphans',
|
|
||||||
'description' => 'Remove actions that are in the database but not supported by any enabled module.',
|
|
||||||
'route_name' => 'action_admin_orphans_remove',
|
|
||||||
'type' => MENU_CALLBACK,
|
|
||||||
);
|
|
||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,6 @@ action_admin:
|
||||||
requirements:
|
requirements:
|
||||||
_permission: 'administer actions'
|
_permission: 'administer actions'
|
||||||
|
|
||||||
action_admin_manage:
|
|
||||||
pattern: '/admin/config/system/actions/manage'
|
|
||||||
defaults:
|
|
||||||
_content: '\Drupal\action\Controller\ActionController::adminManage'
|
|
||||||
requirements:
|
|
||||||
_permission: 'administer actions'
|
|
||||||
|
|
||||||
action_admin_orphans_remove:
|
action_admin_orphans_remove:
|
||||||
pattern: '/admin/config/system/actions/orphan'
|
pattern: '/admin/config/system/actions/orphan'
|
||||||
defaults:
|
defaults:
|
||||||
|
|
|
@ -37,10 +37,10 @@ class ConfigurationTest extends WebTestBase {
|
||||||
$user = $this->drupalCreateUser(array('administer actions'));
|
$user = $this->drupalCreateUser(array('administer actions'));
|
||||||
$this->drupalLogin($user);
|
$this->drupalLogin($user);
|
||||||
|
|
||||||
// Make a POST request to admin/config/system/actions/manage.
|
// Make a POST request to admin/config/system/actions.
|
||||||
$edit = array();
|
$edit = array();
|
||||||
$edit['action'] = drupal_hash_base64('action_goto_action');
|
$edit['action'] = drupal_hash_base64('action_goto_action');
|
||||||
$this->drupalPost('admin/config/system/actions/manage', $edit, t('Create'));
|
$this->drupalPost('admin/config/system/actions', $edit, t('Create'));
|
||||||
|
|
||||||
// Make a POST request to the individual action configuration page.
|
// Make a POST request to the individual action configuration page.
|
||||||
$edit = array();
|
$edit = array();
|
||||||
|
@ -75,7 +75,7 @@ class ConfigurationTest extends WebTestBase {
|
||||||
|
|
||||||
// Make sure that the action was actually deleted.
|
// Make sure that the action was actually deleted.
|
||||||
$this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_label)), 'Make sure that we get a delete confirmation message.');
|
$this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_label)), 'Make sure that we get a delete confirmation message.');
|
||||||
$this->drupalGet('admin/config/system/actions/manage');
|
$this->drupalGet('admin/config/system/actions');
|
||||||
$this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
|
$this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
|
||||||
$exists = db_query('SELECT aid FROM {actions} WHERE callback = :callback', array(':callback' => 'drupal_goto_action'))->fetchField();
|
$exists = db_query('SELECT aid FROM {actions} WHERE callback = :callback', array(':callback' => 'drupal_goto_action'))->fetchField();
|
||||||
$this->assertFalse($exists, 'Make sure the action is gone from the database after being deleted.');
|
$this->assertFalse($exists, 'Make sure the action is gone from the database after being deleted.');
|
||||||
|
|
Loading…
Reference in New Issue