Skip to content

Commit a773ce4

Browse files
committed
Issue #3027595 by amateescu, pmelab: Incorrect blacklist condition in WorkspaceManager
(cherry picked from commit a3a8e46)
1 parent c30ad0b commit a773ce4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

modules/workspaces/src/WorkspaceManager.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class WorkspaceManager implements WorkspaceManagerInterface {
3030
* @var string[]
3131
*/
3232
protected $blacklist = [
33-
'workspace_association',
34-
'workspace',
33+
'workspace_association' => 'workspace_association',
34+
'workspace' => 'workspace',
3535
];
3636

3737
/**
@@ -132,11 +132,17 @@ public function __construct(RequestStack $request_stack, EntityTypeManagerInterf
132132
* {@inheritdoc}
133133
*/
134134
public function isEntityTypeSupported(EntityTypeInterface $entity_type) {
135-
if (!isset($this->blacklist[$entity_type->id()])
136-
&& $entity_type->entityClassImplements(EntityPublishedInterface::class)
137-
&& $entity_type->isRevisionable()) {
135+
// First, check if we already determined whether this entity type is
136+
// supported or not.
137+
if (isset($this->blacklist[$entity_type->id()])) {
138+
return FALSE;
139+
}
140+
141+
if ($entity_type->entityClassImplements(EntityPublishedInterface::class) && $entity_type->isRevisionable()) {
138142
return TRUE;
139143
}
144+
145+
// This entity type can not belong to a workspace, add it to the blacklist.
140146
$this->blacklist[$entity_type->id()] = $entity_type->id();
141147
return FALSE;
142148
}

0 commit comments

Comments
 (0)