function WorkspaceManager::isEntityTypeSupported

Same name and namespace in other branches
  1. 9 core/modules/workspaces/src/WorkspaceManager.php \Drupal\workspaces\WorkspaceManager::isEntityTypeSupported()
  2. 10 core/modules/workspaces/src/WorkspaceManager.php \Drupal\workspaces\WorkspaceManager::isEntityTypeSupported()

Overrides WorkspaceManagerInterface::isEntityTypeSupported

2 calls to WorkspaceManager::isEntityTypeSupported()
WorkspaceManager::getSupportedEntityTypes in core/modules/workspaces/src/WorkspaceManager.php
Returns an array of entity types that can belong to workspaces.
WorkspaceManager::shouldAlterOperations in core/modules/workspaces/src/WorkspaceManager.php
Determines whether runtime entity operations should be altered.

File

core/modules/workspaces/src/WorkspaceManager.php, line 144

Class

WorkspaceManager
Provides the workspace manager.

Namespace

Drupal\workspaces

Code

public function isEntityTypeSupported(EntityTypeInterface $entity_type) {
    // First, check if we already determined whether this entity type is
    // supported or not.
    if (isset($this->blacklist[$entity_type->id()])) {
        return FALSE;
    }
    if ($entity_type->entityClassImplements(EntityPublishedInterface::class) && $entity_type->isRevisionable()) {
        return TRUE;
    }
    // This entity type can not belong to a workspace, add it to the blacklist.
    $this->blacklist[$entity_type->id()] = $entity_type->id();
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.