Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
309
Merge Requests
309
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
b0cf1be9
Commit
b0cf1be9
authored
Jun 06, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1846172
by tim.plunkett, damiankloip: Replace the actions API.
parent
f164dcc5
Changes
92
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
92 changed files
with
2951 additions
and
2169 deletions
+2951
-2169
core/core.services.yml
core/core.services.yml
+3
-0
core/includes/bootstrap.inc
core/includes/bootstrap.inc
+5
-9
core/lib/Drupal/Core/Action/ActionBag.php
core/lib/Drupal/Core/Action/ActionBag.php
+52
-0
core/lib/Drupal/Core/Action/ActionBase.php
core/lib/Drupal/Core/Action/ActionBase.php
+27
-0
core/lib/Drupal/Core/Action/ActionInterface.php
core/lib/Drupal/Core/Action/ActionInterface.php
+28
-0
core/lib/Drupal/Core/Action/ActionManager.php
core/lib/Drupal/Core/Action/ActionManager.php
+52
-0
core/lib/Drupal/Core/Action/ConfigurableActionBase.php
core/lib/Drupal/Core/Action/ConfigurableActionBase.php
+49
-0
core/lib/Drupal/Core/Action/ConfigurableActionInterface.php
core/lib/Drupal/Core/Action/ConfigurableActionInterface.php
+61
-0
core/lib/Drupal/Core/Annotation/Action.php
core/lib/Drupal/Core/Annotation/Action.php
+57
-0
core/lib/Drupal/Core/Entity/EntityManager.php
core/lib/Drupal/Core/Entity/EntityManager.php
+1
-0
core/modules/action/action.admin.inc
core/modules/action/action.admin.inc
+0
-18
core/modules/action/action.api.php
core/modules/action/action.api.php
+0
-80
core/modules/action/action.install
core/modules/action/action.install
+0
-54
core/modules/action/action.module
core/modules/action/action.module
+11
-631
core/modules/action/action.routing.yml
core/modules/action/action.routing.yml
+7
-6
core/modules/action/lib/Drupal/action/ActionAddFormController.php
...ules/action/lib/Drupal/action/ActionAddFormController.php
+75
-0
core/modules/action/lib/Drupal/action/ActionEditFormController.php
...les/action/lib/Drupal/action/ActionEditFormController.php
+15
-0
core/modules/action/lib/Drupal/action/ActionFormControllerBase.php
...les/action/lib/Drupal/action/ActionFormControllerBase.php
+159
-0
core/modules/action/lib/Drupal/action/ActionListController.php
...modules/action/lib/Drupal/action/ActionListController.php
+137
-0
core/modules/action/lib/Drupal/action/Controller/ActionController.php
.../action/lib/Drupal/action/Controller/ActionController.php
+0
-139
core/modules/action/lib/Drupal/action/Form/ActionAdminConfigureForm.php
...ction/lib/Drupal/action/Form/ActionAdminConfigureForm.php
+0
-125
core/modules/action/lib/Drupal/action/Form/ActionAdminManageForm.php
...s/action/lib/Drupal/action/Form/ActionAdminManageForm.php
+45
-11
core/modules/action/lib/Drupal/action/Form/DeleteForm.php
core/modules/action/lib/Drupal/action/Form/DeleteForm.php
+10
-11
core/modules/action/lib/Drupal/action/Plugin/Action/EmailAction.php
...es/action/lib/Drupal/action/Plugin/Action/EmailAction.php
+163
-0
core/modules/action/lib/Drupal/action/Plugin/Action/GotoAction.php
...les/action/lib/Drupal/action/Plugin/Action/GotoAction.php
+62
-0
core/modules/action/lib/Drupal/action/Plugin/Action/MessageAction.php
.../action/lib/Drupal/action/Plugin/Action/MessageAction.php
+92
-0
core/modules/action/lib/Drupal/action/Plugin/views/field/BulkForm.php
.../action/lib/Drupal/action/Plugin/views/field/BulkForm.php
+7
-21
core/modules/action/lib/Drupal/action/Tests/ConfigurationTest.php
...ules/action/lib/Drupal/action/Tests/ConfigurationTest.php
+22
-9
core/modules/action/lib/Drupal/action/Tests/LoopTest.php
core/modules/action/lib/Drupal/action/Tests/LoopTest.php
+0
-82
core/modules/action/tests/action_loop_test/action_loop_test.install
...es/action/tests/action_loop_test/action_loop_test.install
+0
-8
core/modules/action/tests/action_loop_test/action_loop_test.module
...les/action/tests/action_loop_test/action_loop_test.module
+0
-83
core/modules/comment/comment.admin.inc
core/modules/comment/comment.admin.inc
+1
-1
core/modules/comment/comment.module
core/modules/comment/comment.module
+0
-155
core/modules/comment/config/action.action.comment_publish_action.yml
...s/comment/config/action.action.comment_publish_action.yml
+6
-0
core/modules/comment/config/action.action.comment_save_action.yml
...ules/comment/config/action.action.comment_save_action.yml
+6
-0
core/modules/comment/config/action.action.comment_unpublish_action.yml
...comment/config/action.action.comment_unpublish_action.yml
+6
-0
core/modules/comment/lib/Drupal/comment/Plugin/Action/PublishComment.php
...mment/lib/Drupal/comment/Plugin/Action/PublishComment.php
+33
-0
core/modules/comment/lib/Drupal/comment/Plugin/Action/SaveComment.php
.../comment/lib/Drupal/comment/Plugin/Action/SaveComment.php
+34
-0
core/modules/comment/lib/Drupal/comment/Plugin/Action/UnpublishByKeywordComment.php
...rupal/comment/Plugin/Action/UnpublishByKeywordComment.php
+69
-0
core/modules/comment/lib/Drupal/comment/Plugin/Action/UnpublishComment.php
...ent/lib/Drupal/comment/Plugin/Action/UnpublishComment.php
+33
-0
core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php
...s/comment/lib/Drupal/comment/Tests/CommentActionsTest.php
+17
-44
core/modules/node/config/action.action.node_delete_action.yml
.../modules/node/config/action.action.node_delete_action.yml
+6
-0
core/modules/node/config/action.action.node_make_sticky_action.yml
...les/node/config/action.action.node_make_sticky_action.yml
+6
-0
core/modules/node/config/action.action.node_make_unsticky_action.yml
...s/node/config/action.action.node_make_unsticky_action.yml
+6
-0
core/modules/node/config/action.action.node_promote_action.yml
...modules/node/config/action.action.node_promote_action.yml
+6
-0
core/modules/node/config/action.action.node_publish_action.yml
...modules/node/config/action.action.node_publish_action.yml
+6
-0
core/modules/node/config/action.action.node_save_action.yml
core/modules/node/config/action.action.node_save_action.yml
+6
-0
core/modules/node/config/action.action.node_unpromote_action.yml
...dules/node/config/action.action.node_unpromote_action.yml
+6
-0
core/modules/node/config/action.action.node_unpublish_action.yml
...dules/node/config/action.action.node_unpublish_action.yml
+6
-0
core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
+126
-0
core/modules/node/lib/Drupal/node/Plugin/Action/AssignOwnerNode.php
...es/node/lib/Drupal/node/Plugin/Action/AssignOwnerNode.php
+135
-0
core/modules/node/lib/Drupal/node/Plugin/Action/DeleteNode.php
...modules/node/lib/Drupal/node/Plugin/Action/DeleteNode.php
+74
-0
core/modules/node/lib/Drupal/node/Plugin/Action/DemoteNode.php
...modules/node/lib/Drupal/node/Plugin/Action/DemoteNode.php
+33
-0
core/modules/node/lib/Drupal/node/Plugin/Action/PromoteNode.php
...odules/node/lib/Drupal/node/Plugin/Action/PromoteNode.php
+34
-0
core/modules/node/lib/Drupal/node/Plugin/Action/PublishNode.php
...odules/node/lib/Drupal/node/Plugin/Action/PublishNode.php
+33
-0
core/modules/node/lib/Drupal/node/Plugin/Action/SaveNode.php
core/modules/node/lib/Drupal/node/Plugin/Action/SaveNode.php
+32
-0
core/modules/node/lib/Drupal/node/Plugin/Action/StickyNode.php
...modules/node/lib/Drupal/node/Plugin/Action/StickyNode.php
+34
-0
core/modules/node/lib/Drupal/node/Plugin/Action/UnpublishByKeywordNode.php
.../lib/Drupal/node/Plugin/Action/UnpublishByKeywordNode.php
+68
-0
core/modules/node/lib/Drupal/node/Plugin/Action/UnpublishNode.php
...ules/node/lib/Drupal/node/Plugin/Action/UnpublishNode.php
+33
-0
core/modules/node/lib/Drupal/node/Plugin/Action/UnstickyNode.php
...dules/node/lib/Drupal/node/Plugin/Action/UnstickyNode.php
+33
-0
core/modules/node/node.admin.inc
core/modules/node/node.admin.inc
+10
-59
core/modules/node/node.api.php
core/modules/node/node.api.php
+0
-58
core/modules/node/node.module
core/modules/node/node.module
+0
-326
core/modules/node/node.routing.yml
core/modules/node/node.routing.yml
+6
-0
core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php
...pletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php
+1
-1
core/modules/system/lib/Drupal/system/ActionConfigEntityInterface.php
.../system/lib/Drupal/system/ActionConfigEntityInterface.php
+38
-0
core/modules/system/lib/Drupal/system/ActionStorageController.php
...ules/system/lib/Drupal/system/ActionStorageController.php
+32
-0
core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php
...es/system/lib/Drupal/system/Plugin/Core/Entity/Action.php
+179
-0
core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php
...tem/lib/Drupal/system/Plugin/views/field/BulkFormBase.php
+53
-2
core/modules/system/lib/Drupal/system/Tests/Action/ActionUnitTest.php
.../system/lib/Drupal/system/Tests/Action/ActionUnitTest.php
+86
-0
core/modules/system/lib/Drupal/system/Tests/Upgrade/ActionUpgradePathTest.php
...lib/Drupal/system/Tests/Upgrade/ActionUpgradePathTest.php
+42
-0
core/modules/system/system.install
core/modules/system/system.install
+26
-0
core/modules/system/tests/modules/action_test/action_test.info.yml
...les/system/tests/modules/action_test/action_test.info.yml
+7
-0
core/modules/system/tests/modules/action_test/action_test.module
...dules/system/tests/modules/action_test/action_test.module
+1
-0
core/modules/system/tests/modules/action_test/lib/Drupal/action_test/Plugin/Action/NoType.php
...tion_test/lib/Drupal/action_test/Plugin/Action/NoType.php
+30
-0
core/modules/system/tests/modules/action_test/lib/Drupal/action_test/Plugin/Action/SaveEntity.php
..._test/lib/Drupal/action_test/Plugin/Action/SaveEntity.php
+32
-0
core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
.../modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
+1
-1
core/modules/user/config/action.action.user_block_user_action.yml
...ules/user/config/action.action.user_block_user_action.yml
+6
-0
core/modules/user/config/action.action.user_cancel_user_action.yml
...les/user/config/action.action.user_cancel_user_action.yml
+6
-0
core/modules/user/config/action.action.user_unblock_user_action.yml
...es/user/config/action.action.user_unblock_user_action.yml
+6
-0
core/modules/user/lib/Drupal/user/Plugin/Action/AddRoleUser.php
...odules/user/lib/Drupal/user/Plugin/Action/AddRoleUser.php
+41
-0
core/modules/user/lib/Drupal/user/Plugin/Action/BlockUser.php
.../modules/user/lib/Drupal/user/Plugin/Action/BlockUser.php
+39
-0
core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
...modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
+74
-0
core/modules/user/lib/Drupal/user/Plugin/Action/ChangeUserRoleBase.php
...user/lib/Drupal/user/Plugin/Action/ChangeUserRoleBase.php
+49
-0
core/modules/user/lib/Drupal/user/Plugin/Action/RemoveRoleUser.php
...les/user/lib/Drupal/user/Plugin/Action/RemoveRoleUser.php
+41
-0
core/modules/user/lib/Drupal/user/Plugin/Action/UnblockUser.php
...odules/user/lib/Drupal/user/Plugin/Action/UnblockUser.php
+36
-0
core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
+2
-2
core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
+2
-2
core/modules/user/user.admin.inc
core/modules/user/user.admin.inc
+10
-16
core/modules/user/user.api.php
core/modules/user/user.api.php
+0
-34
core/modules/user/user.module
core/modules/user/user.module
+65
-179
core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php
...les/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php
+2
-2
No files found.
core/core.services.yml
View file @
b0cf1be9
...
...
@@ -154,6 +154,9 @@ services:
plugin.manager.archiver
:
class
:
Drupal\Core\Archiver\ArchiverManager
arguments
:
[
'
@container.namespaces'
]
plugin.manager.action
:
class
:
Drupal\Core\Action\ActionManager
arguments
:
[
'
@container.namespaces'
]
request
:
class
:
Symfony\Component\HttpFoundation\Request
event_dispatcher
:
...
...
core/includes/bootstrap.inc
View file @
b0cf1be9
...
...
@@ -2929,16 +2929,12 @@ function drupal_classloader_register($name, $path) {
*
* Example:
* @code
* function actions_do(...) {
* // $stack tracks the number of recursive calls.
* static $stack;
* $stack++;
* if ($stack > variable_get('action_max_stack', 35)) {
* ...
* return;
* function system_get_module_info($property) {
* static $info;
* if (!isset($info)) {
* $info = new ModuleInfo('system_info', 'cache');
* }
* ...
* $stack--;
* return $info[$property];
* }
* @endcode
*
...
...
core/lib/Drupal/Core/Action/ActionBag.php
0 → 100644
View file @
b0cf1be9
<?php
/**
* @file
* Contains \Drupal\Core\Action\ActionBag.
*/
namespace
Drupal\Core\Action
;
use
Drupal\Component\Plugin\PluginBag
;
use
Drupal\Component\Plugin\PluginManagerInterface
;
/**
* Provides a container for lazily loading Action plugins.
*/
class
ActionBag
extends
PluginBag
{
/**
* The manager used to instantiate the plugins.
*
* @var \Drupal\Component\Plugin\PluginManagerInterface
*/
protected
$manager
;
/**
* Constructs a new ActionBag object.
*
* @param \Drupal\Component\Plugin\PluginManagerInterface $manager
* The manager to be used for instantiating plugins.
* @param array $instance_ids
* The ids of the plugin instances with which we are dealing.
* @param array $configuration
* An array of configuration.
*/
public
function
__construct
(
PluginManagerInterface
$manager
,
array
$instance_ids
,
array
$configuration
)
{
$this
->
manager
=
$manager
;
$this
->
instanceIDs
=
drupal_map_assoc
(
$instance_ids
);
$this
->
configuration
=
$configuration
;
}
/**
* {@inheritdoc}
*/
protected
function
initializePlugin
(
$instance_id
)
{
if
(
isset
(
$this
->
pluginInstances
[
$instance_id
]))
{
return
;
}
$this
->
pluginInstances
[
$instance_id
]
=
$this
->
manager
->
createInstance
(
$instance_id
,
$this
->
configuration
);
}
}
core/lib/Drupal/Core/Action/ActionBase.php
0 → 100644
View file @
b0cf1be9
<?php
/**
* @file
* Contains \Drupal\Core\Action\ActionBase.
*/
namespace
Drupal\Core\Action
;
use
Drupal\Core\Action\ActionInterface
;
use
Drupal\Core\Plugin\ContainerFactoryPluginBase
;
/**
* Provides a base implementation for an Action plugin.
*/
abstract
class
ActionBase
extends
ContainerFactoryPluginBase
implements
ActionInterface
{
/**
* {@inheritdoc}
*/
public
function
executeMultiple
(
array
$entities
)
{
foreach
(
$entities
as
$entity
)
{
$this
->
execute
(
$entity
);
}
}
}
core/lib/Drupal/Core/Action/ActionInterface.php
0 → 100644
View file @
b0cf1be9
<?php
/**
* @file
* Contains \Drupal\Core\Action\ActionInterface.
*/
namespace
Drupal\Core\Action
;
use
Drupal\Core\Executable\ExecutableInterface
;
/**
* Provides an interface for an Action plugin.
*
* @see \Drupal\Core\Annotation\Action
* @see \Drupal\Core\Action\ActionManager
*/
interface
ActionInterface
extends
ExecutableInterface
{
/**
* Executes the plugin for an array of objects.
*
* @param array $objects
* An array of entities.
*/
public
function
executeMultiple
(
array
$objects
);
}
core/lib/Drupal/Core/Action/ActionManager.php
0 → 100644
View file @
b0cf1be9
<?php
/**
* @file
* Contains \Drupal\Core\Action\ActionManager.
*/
namespace
Drupal\Core\Action
;
use
Drupal\Component\Plugin\PluginManagerBase
;
use
Drupal\Core\Plugin\Discovery\AlterDecorator
;
use
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery
;
use
Drupal\Core\Plugin\Factory\ContainerFactory
;
/**
* Provides an Action plugin manager.
*
* @see \Drupal\Core\Annotation\Operation
* @see \Drupal\Core\Action\OperationInterface
*/
class
ActionManager
extends
PluginManagerBase
{
/**
* Constructs a ActionManager object.
*
* @param \Traversable $namespaces
* An object that implements \Traversable which contains the root paths
* keyed by the corresponding namespace to look for plugin implementations.
*/
public
function
__construct
(
\
Traversable
$namespaces
)
{
$this
->
discovery
=
new
AnnotatedClassDiscovery
(
'Action'
,
$namespaces
,
array
(),
'Drupal\Core\Annotation\Action'
);
$this
->
discovery
=
new
AlterDecorator
(
$this
->
discovery
,
'action_info'
);
$this
->
factory
=
new
ContainerFactory
(
$this
);
}
/**
* Gets the plugin definitions for this entity type.
*
* @param string $type
* The entity type name.
*
* @return array
* An array of plugin definitions for this entity type.
*/
public
function
getDefinitionsByType
(
$type
)
{
return
array_filter
(
$this
->
getDefinitions
(),
function
(
$definition
)
use
(
$type
)
{
return
$definition
[
'type'
]
===
$type
;
});
}
}
core/lib/Drupal/Core/Action/ConfigurableActionBase.php
0 → 100644
View file @
b0cf1be9
<?php
/**
* @file
* Contains \Drupal\Core\Action\ConfigurableActionBase.
*/
namespace
Drupal\Core\Action
;
use
Drupal\Core\Action\ConfigurableActionInterface
;
use
Drupal\Core\Action\ActionBase
;
/**
* Provides a base implementation for a configurable Action plugin.
*/
abstract
class
ConfigurableActionBase
extends
ActionBase
implements
ConfigurableActionInterface
{
/**
* {@inheritdoc}
*/
public
function
__construct
(
array
$configuration
,
$plugin_id
,
array
$plugin_definition
)
{
parent
::
__construct
(
$configuration
,
$plugin_id
,
$plugin_definition
);
$this
->
configuration
+=
$this
->
getDefaultConfiguration
();
}
/**
* Returns default configuration for this action.
*
* @return array
*/
protected
function
getDefaultConfiguration
()
{
return
array
();
}
/**
* {@inheritdoc}
*/
public
function
getConfiguration
()
{
return
$this
->
configuration
;
}
/**
* {@inheritdoc}
*/
public
function
validate
(
array
&
$form
,
array
&
$form_state
)
{
}
}
core/lib/Drupal/Core/Action/ConfigurableActionInterface.php
0 → 100644
View file @
b0cf1be9
<?php
/**
* @file
* Contains \Drupal\Core\Action\ConfigurableActionInterface.
*/
namespace
Drupal\Core\Action
;
use
Drupal\Core\Action\ActionInterface
;
/**
* Provides an interface for an Action plugin.
*
* @see \Drupal\Core\Annotation\Operation
* @see \Drupal\Core\Action\OperationManager
*/
interface
ConfigurableActionInterface
extends
ActionInterface
{
/**
* Returns this plugin's configuration.
*
* @return array
* An array of this action plugin's configuration.
*/
public
function
getConfiguration
();
/**
* Form constructor.
*
* @param array $form
* An associative array containing the structure of the form.
* @param array $form_state
* An associative array containing the current state of the form.
*
* @return array
* The form structure.
*/
public
function
form
(
array
$form
,
array
&
$form_state
);
/**
* Form validation handler.
*
* @param array $form
* An associative array containing the structure of the form.
* @param array $form_state
* An associative array containing the current state of the form.
*/
public
function
validate
(
array
&
$form
,
array
&
$form_state
);
/**
* Form submission handler.
*
* @param array $form
* An associative array containing the structure of the form.
* @param array $form_state
* An associative array containing the current state of the form.
*/
public
function
submit
(
array
&
$form
,
array
&
$form_state
);
}
core/lib/Drupal/Core/Annotation/Action.php
0 → 100644
View file @
b0cf1be9
<?php
/**
* @file
* Contains \Drupal\Core\Annotation\Action.
*/
namespace
Drupal\Core\Annotation
;
use
Drupal\Component\Annotation\Plugin
;
/**
* Defines an Action annotation object.
*
* @see \Drupal\Core\Action\ActionInterface
* @see \Drupal\Core\Action\ActionManager
*
* @Annotation
*/
class
Action
extends
Plugin
{
/**
* The plugin ID.
*
* @var string
*/
public
$id
;
/**
* The human-readable name of the action plugin.
*
* @ingroup plugin_translatable
*
* @var \Drupal\Core\Annotation\Translation
*/
public
$label
;
/**
* The path for a confirmation form for this action.
*
* @todo Change this to accept a route.
* @todo Provide a more generic way to allow an action to be confirmed first.
*
* @var string (optional)
*/
public
$confirm_form_path
=
''
;
/**
* The entity type the action can apply to.
*
* @todo Replace with \Drupal\Core\Plugin\Context\Context.
*
* @var string
*/
public
$type
=
''
;
}
core/lib/Drupal/Core/Entity/EntityManager.php
View file @
b0cf1be9
...
...
@@ -185,6 +185,7 @@ public function getFormController($entity_type, $operation) {
$class
=
$this
->
getControllerClass
(
$entity_type
,
'form'
,
$operation
);
if
(
in_array
(
'Drupal\Core\Entity\EntityControllerInterface'
,
class_implements
(
$class
)))
{
$this
->
controllers
[
'form'
][
$operation
][
$entity_type
]
=
$class
::
createInstance
(
$this
->
container
,
$entity_type
,
$this
->
getDefinition
(
$entity_type
));
$this
->
controllers
[
'form'
][
$operation
][
$entity_type
]
->
setOperation
(
$operation
);
}
else
{
$this
->
controllers
[
'form'
][
$operation
][
$entity_type
]
=
new
$class
(
$operation
);
...
...
core/modules/action/action.admin.inc
deleted
100644 → 0
View file @
f164dcc5
<?php
/**
* @file
* Admin page callbacks for the Action module.
*/
/**
* Post-deletion operations for deleting action orphans.
*
* @param $orphaned
* An array of orphaned actions.
*/
function
action_admin_delete_orphans_post
(
$orphaned
)
{
foreach
(
$orphaned
as
$callback
)
{
drupal_set_message
(
t
(
"Deleted orphaned action (%action)."
,
array
(
'%action'
=>
$callback
)));
}
}
core/modules/action/action.api.php
View file @
b0cf1be9
...
...
@@ -5,91 +5,11 @@
* Hooks provided by the Actions module.
*/
/**
* Declares information about actions.
*
* Any module can define actions, and then call actions_do() to make those
* actions happen in response to events.
*
* An action consists of two or three parts:
* - an action definition (returned by this hook)
* - a function which performs the action (which by convention is named
* MODULE_description-of-function_action)
* - an optional form definition function that defines a configuration form
* (which has the name of the action function with '_form' appended to it.)
*
* The action function takes two to four arguments, which come from the input
* arguments to actions_do().
*
* @return
* An associative array of action descriptions. The keys of the array
* are the names of the action functions, and each corresponding value
* is an associative array with the following key-value pairs:
* - 'type': The type of object this action acts upon. Core actions have types
* 'node', 'user', 'comment', and 'system'.
* - 'label': The human-readable name of the action, which should be passed
* through the t() function for translation.
* - 'configurable': If FALSE, then the action doesn't require any extra
* configuration. If TRUE, then your module must define a form function with
* the same name as the action function with '_form' appended (e.g., the
* form for 'node_assign_owner_action' is 'node_assign_owner_action_form'.)
* This function takes $context as its only parameter, and is paired with
* the usual _submit function, and possibly a _validate function.
* - 'triggers': An array of the events (that is, hooks) that can trigger this
* action. For example: array('node_insert', 'user_update'). You can also
* declare support for any trigger by returning array('any') for this value.
* - 'behavior': (optional) A machine-readable array of behaviors of this
* action, used to signal additionally required actions that may need to be
* triggered. Modules that are processing actions should take special care
* for the "presave" hook, in which case a dependent "save" action should
* NOT be invoked.
*
* @ingroup actions
*/
function
hook_action_info
()
{
return
array
(
'comment_unpublish_action'
=>
array
(
'type'
=>
'comment'
,
'label'
=>
t
(
'Unpublish comment'
),
'configurable'
=>
FALSE
,
'behavior'
=>
array
(
'changes_property'
),
'triggers'
=>
array
(
'comment_presave'
,
'comment_insert'
,
'comment_update'
),
),
'comment_unpublish_by_keyword_action'
=>
array
(
'type'
=>
'comment'
,
'label'
=>
t
(
'Unpublish comment containing keyword(s)'
),
'configurable'
=>
TRUE
,
'behavior'
=>
array
(
'changes_property'
),
'triggers'
=>
array
(
'comment_presave'
,
'comment_insert'
,
'comment_update'
),
),
'comment_save_action'
=>
array
(
'type'
=>
'comment'
,
'label'
=>
t
(
'Save comment'
),
'configurable'
=>
FALSE
,
'triggers'
=>
array
(
'comment_insert'
,
'comment_update'
),
),
);
}
/**
* Alters the actions declared by another module.
*
* Called by action_list() to allow modules to alter the return values from
* implementations of hook_action_info().
*
* @ingroup actions
*/
function
hook_action_info_alter
(
&
$actions
)
{
$actions
[
'node_unpublish_action'
][
'label'
]
=
t
(
'Unpublish and remove from public view.'
);
}
/**
* Executes code after an action is deleted.
*
* @param $aid
* The action ID.
*
* @ingroup actions
*/
function
hook_action_delete
(
$aid
)
{
db_delete
(
'actions_assignments'
)
...
...
core/modules/action/action.install
deleted
100644 → 0
View file @
f164dcc5
<?php
/**
* @file
* Install, update and uninstall functions for the Actions module.
*/
/**
* Implements hook_schema().
*/
function
action_schema
()
{
// 'action' is a reserved SQL keyword.
$schema
[
'actions'
]
=
array
(
'description'
=>
'Stores action information.'
,
'fields'
=>
array
(
'aid'
=>
array
(
'description'
=>
'Primary Key: Unique action ID.'
,
'type'
=>
'varchar'
,
'length'
=>
255
,
'not null'
=>
TRUE
,
'default'
=>
'0'
,
),
'type'
=>
array
(
'description'
=>
'The object that that action acts on (node, user, comment, system or custom types.)'
,
'type'
=>
'varchar'
,
'length'
=>
32
,
'not null'
=>
TRUE
,
'default'
=>
''
,
),
'callback'
=>
array
(
'description'
=>
'The callback function that executes when the action runs.'
,
'type'
=>
'varchar'
,
'length'
=>
255
,
'not null'
=>
TRUE
,
'default'
=>
''
,
),
'parameters'
=>
array
(
'description'
=>
'Parameters to be passed to the callback function.'
,
'type'
=>
'blob'
,
'not null'
=>
TRUE
,
'size'
=>
'big'
,
),
'label'
=>
array
(
'description'
=>
'Label of the action.'
,
'type'
=>
'varchar'
,
'length'
=>
255
,
'not null'
=>
TRUE
,
'default'
=>
'0'
,
),
),
'primary key'
=>
array
(
'aid'
),
);
return
$schema
;
}
core/modules/action/action.module
View file @
b0cf1be9
This diff is collapsed.
Click to expand it.
core/modules/action/action.routing.yml
View file @
b0cf1be9
action_admin
:
pattern
:
'
/admin/config/system/actions'
defaults
:
_content
:
'
\Drupal\action\Controller\ActionController::adminManage'
_content
:
'
\Drupal\Core\Entity\Controller\EntityListController::listing'
entity_type
:
'
action'
requirements
:
_permission
:
'
administer
actions'
action_admin_
orphans_remove
:
pattern
:
'
/admin/config/system/actions/
orphan
'
action_admin_
add
:
pattern
:
'
/admin/config/system/actions/
add/{action_id}
'
defaults
:
_
content
:
'
\Drupal\action\Controller\ActionController::adminRemoveOrphans
'
_
entity_form
:
'
action.add
'
requirements
:
_permission
:
'
administer
actions'
action_admin_configure
:
pattern
:
'
/admin/config/system/actions/configure/{action}'
defaults
:
_
form
:
'
\Drupal\action\Form\ActionAdminConfigureForm
'
_
entity_form
:
'
action.edit
'
requirements
:
_permission
:
'
administer
actions'
action_delete
:
pattern
:
'
admin/config/system/actions/
delete/{action}
'
pattern
:
'
admin/config/system/actions/
configure/{action}/delete
'
defaults
:
_form
:
'
\Drupal\action\Form\DeleteForm'
requirements
:
...
...
core/modules/action/lib/Drupal/action/ActionAddFormController.php
0 → 100644
View file @
b0cf1be9
<?php