Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eca-3354653
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
eca-3354653
Commits
03e9abe6
Commit
03e9abe6
authored
2 years ago
by
Jürgen Haas
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3314320
by jurgenhaas: Broken pre-configured actions with missing plugins may cause WSOD
parent
e7bfd4a7
No related branches found
Branches containing commit
Tags
8.x-2.0-beta1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/Action/PreConfiguredActionDeriver.php
+30
-1
30 additions, 1 deletion
src/Plugin/Action/PreConfiguredActionDeriver.php
with
30 additions
and
1 deletion
src/Plugin/Action/PreConfiguredActionDeriver.php
+
30
−
1
View file @
03e9abe6
...
...
@@ -3,7 +3,9 @@
namespace
Drupal\eca\Plugin\Action
;
use
Drupal\Component\Plugin\Derivative\DeriverBase
;
use
Drupal\Component\Plugin\Exception\PluginNotFoundException
;
use
Drupal\Core\Config\Entity\ConfigEntityStorageInterface
;
use
Drupal\Core\Logger\LoggerChannelInterface
;
use
Drupal\Core\Plugin\Discovery\ContainerDeriverInterface
;
use
Drupal\eca\PluginManager\Action
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
...
...
@@ -34,6 +36,13 @@ class PreConfiguredActionDeriver extends DeriverBase implements ContainerDeriver
*/
protected
Action
$actionPluginManager
;
/**
* The logger channel.
*
* @var \Drupal\Core\Logger\LoggerChannelInterface
*/
protected
LoggerChannelInterface
$logger
;
/**
* {@inheritdoc}
*/
...
...
@@ -41,6 +50,7 @@ class PreConfiguredActionDeriver extends DeriverBase implements ContainerDeriver
$instance
=
new
static
();
$instance
->
setActionEntityStorage
(
$container
->
get
(
'entity_type.manager'
)
->
getStorage
(
'action'
));
$instance
->
setActionPluginManager
(
$container
->
get
(
'plugin.manager.eca.action'
));
$instance
->
setLogger
(
$container
->
get
(
'logger.channel.eca'
));
return
$instance
;
}
...
...
@@ -58,12 +68,21 @@ class PreConfiguredActionDeriver extends DeriverBase implements ContainerDeriver
$this
->
derivatives
=
[];
/** @var \Drupal\system\Entity\Action $action */
foreach
(
$this
->
actionEntityStorage
->
loadMultiple
()
as
$action
)
{
try
{
$pluginDefinition
=
$action
->
getPluginDefinition
();
}
catch
(
PluginNotFoundException
$ex
)
{
$this
->
logger
->
error
(
'Preconfigured action with a missing plugin found. You should delete that action with "drush config:delete system.action.@plugin". @msg'
,
[
'@plugin'
=>
$action
->
id
(),
'@msg'
=>
$ex
->
getMessage
(),
]);
continue
;
}
$id
=
$action
->
id
();
$this
->
derivatives
[
$id
]
=
[
'label'
=>
'Pre-configured: '
.
$action
->
label
(),
'action_entity_id'
=>
$id
,
]
+
$base_plugin_definition
;
$pluginDefinition
=
$action
->
getPluginDefinition
();
foreach
([
'type'
,
'confirm_form_route_name'
]
as
$key
)
{
if
(
isset
(
$pluginDefinition
[
$key
]))
{
$this
->
derivatives
[
$action
->
id
()][
$key
]
=
$pluginDefinition
[
$key
];
...
...
@@ -100,4 +119,14 @@ class PreConfiguredActionDeriver extends DeriverBase implements ContainerDeriver
$this
->
actionPluginManager
=
$manager
;
}
/**
* Set the logger channel.
*
* @param \Drupal\Core\Logger\LoggerChannelInterface $logger
* The logger channel.
*/
public
function
setLogger
(
LoggerChannelInterface
$logger
):
void
{
$this
->
logger
=
$logger
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment