function WorkspaceInformation::isEntityTypeSupported

Same name and namespace in other branches
  1. 10 core/modules/workspaces/src/WorkspaceInformation.php \Drupal\workspaces\WorkspaceInformation::isEntityTypeSupported()
2 calls to WorkspaceInformation::isEntityTypeSupported()
WorkspaceInformation::getSupportedEntityTypes in core/modules/workspaces/src/WorkspaceInformation.php
WorkspaceInformation::isEntitySupported in core/modules/workspaces/src/WorkspaceInformation.php

File

core/modules/workspaces/src/WorkspaceInformation.php, line 52

Class

WorkspaceInformation
General service for workspace support information.

Namespace

Drupal\workspaces

Code

public function isEntityTypeSupported(EntityTypeInterface $entity_type) : bool {
    if (!isset($this->supported[$entity_type->id()])) {
        if ($entity_type->hasHandlerClass('workspace')) {
            $supported = !is_a($entity_type->getHandlerClass('workspace'), IgnoredWorkspaceHandler::class, TRUE);
        }
        else {
            // Fallback for cases when entity type info hasn't been altered yet, for
            // example when the Workspaces module is being installed.
            $supported = $entity_type->entityClassImplements(EntityPublishedInterface::class) && $entity_type->isRevisionable();
        }
        $this->supported[$entity_type->id()] = $supported;
    }
    return $this->supported[$entity_type->id()];
}

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