Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
6a6c0654
Commit
6a6c0654
authored
Apr 15, 2013
by
catch
Browse files
Issue
#1946318
by kim.pepper: Convert confirm_form() in action.admin.inc to the new form interface.
parent
139ba191
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/modules/action/action.admin.inc
View file @
6a6c0654
...
...
@@ -5,38 +5,6 @@
* Admin page callbacks for the Action module.
*/
/**
* Creates the form for confirmation of deleting an action.
*
* @see action_admin_delete_form_submit()
* @ingroup forms
*/
function
action_admin_delete_form
(
$form
,
&
$form_state
,
$action
)
{
$form
[
'aid'
]
=
array
(
'#type'
=>
'hidden'
,
'#value'
=>
$action
->
aid
,
);
return
confirm_form
(
$form
,
t
(
'Are you sure you want to delete the action %action?'
,
array
(
'%action'
=>
$action
->
label
)),
'admin/config/system/actions'
,
t
(
'This cannot be undone.'
),
t
(
'Delete'
),
t
(
'Cancel'
)
);
}
/**
* Form submission handler for action_admin_delete_form().
*/
function
action_admin_delete_form_submit
(
$form
,
&
$form_state
)
{
$aid
=
$form_state
[
'values'
][
'aid'
];
$action
=
action_load
(
$aid
);
action_delete
(
$aid
);
watchdog
(
'user'
,
'Deleted action %aid (%action)'
,
array
(
'%aid'
=>
$aid
,
'%action'
=>
$action
->
label
));
drupal_set_message
(
t
(
'Action %action was deleted'
,
array
(
'%action'
=>
$action
->
label
)));
$form_state
[
'redirect'
]
=
'admin/config/system/actions'
;
}
/**
* Post-deletion operations for deleting action orphans.
*
...
...
@@ -48,4 +16,3 @@ function action_admin_delete_orphans_post($orphaned) {
drupal_set_message
(
t
(
"Deleted orphaned action (%action)."
,
array
(
'%action'
=>
$callback
)));
}
}
core/modules/action/action.module
View file @
6a6c0654
...
...
@@ -75,10 +75,7 @@ function action_menu() {
$items
[
'admin/config/system/actions/delete/%action'
]
=
array
(
'title'
=>
'Delete action'
,
'description'
=>
'Delete an action.'
,
'page callback'
=>
'drupal_get_form'
,
'page arguments'
=>
array
(
'action_admin_delete_form'
,
5
),
'access arguments'
=>
array
(
'administer actions'
),
'file'
=>
'action.admin.inc'
,
'route_name'
=>
'action_delete'
,
);
return
$items
;
}
...
...
core/modules/action/action.routing.yml
View file @
6a6c0654
...
...
@@ -18,3 +18,11 @@ action_admin_configure:
_form
:
'
\Drupal\action\Form\ActionAdminConfigureForm'
requirements
:
_permission
:
'
administer
actions'
action_delete
:
pattern
:
'
admin/config/system/actions/delete/{action}'
defaults
:
_form
:
'
\Drupal\action\Form\DeleteForm'
requirements
:
_permission
:
'
administer
actions'
core/modules/action/lib/Drupal/action/Form/DeleteForm.php
0 → 100644
View file @
6a6c0654
<?php
/**
* @file
* Contains \Drupal\action\Form\DeleteForm.
*/
namespace
Drupal\action\Form
;
use
Drupal\Core\Form\ConfirmFormBase
;
/**
* Builds a form to delete an action.
*/
class
DeleteForm
extends
ConfirmFormBase
{
/**
* The action to be deleted.
*
* @var \stdClass
*/
protected
$action
;
/**
* {@inheritdoc}
*/
protected
function
getQuestion
()
{
return
t
(
'Are you sure you want to delete the action %action?'
,
array
(
'%action'
=>
$this
->
action
->
label
));
}
/**
* {@inheritdoc}
*/
protected
function
getConfirmText
()
{
return
t
(
'Delete'
);
}
/**
* {@inheritdoc}
*/
protected
function
getCancelPath
()
{
return
'admin/config/system/actions/manage'
;
}
/**
* {@inheritdoc}
*/
public
function
getFormID
()
{
return
'action_admin_delete_form'
;
}
/**
* {@inheritdoc}
*/
public
function
buildForm
(
array
$form
,
array
&
$form_state
,
$action
=
NULL
)
{
$this
->
action
=
action_load
(
$action
);
return
parent
::
buildForm
(
$form
,
$form_state
);
}
/**
* {@inheritdoc}
*/
public
function
submitForm
(
array
&
$form
,
array
&
$form_state
)
{
action_delete
(
$this
->
action
->
aid
);
watchdog
(
'user'
,
'Deleted action %aid (%action)'
,
array
(
'%aid'
=>
$this
->
action
->
aid
,
'%action'
=>
$this
->
action
->
label
));
drupal_set_message
(
t
(
'Action %action was deleted'
,
array
(
'%action'
=>
$this
->
action
->
label
)));
$form_state
[
'redirect'
]
=
'admin/config/system/actions/manage'
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment