Neos\Neos\Domain\Strategy\AssetUsageInNodePropertiesStrategy::getUsageReferences PHP Метод

getUsageReferences() публичный Метод

Returns an array of usage reference objects.
public getUsageReferences ( Neos\Media\Domain\Model\AssetInterface $asset ) : array<\Neos\Neos\Domain\Model\Dto\AssetUsageInNodeProperties>
$asset Neos\Media\Domain\Model\AssetInterface
Результат array<\Neos\Neos\Domain\Model\Dto\AssetUsageInNodeProperties>
    public function getUsageReferences(AssetInterface $asset)
    {
        $assetIdentifier = $this->persistenceManager->getIdentifierByObject($asset);
        if (isset($this->firstlevelCache[$assetIdentifier])) {
            return $this->firstlevelCache[$assetIdentifier];
        }
        $userWorkspace = $this->userService->getPersonalWorkspace();
        $relatedNodes = [];
        foreach ($this->getRelatedNodes($asset) as $relatedNodeData) {
            $accessible = $this->domainUserService->currentUserCanReadWorkspace($relatedNodeData->getWorkspace());
            if ($accessible) {
                $context = $this->createContextMatchingNodeData($relatedNodeData);
            } else {
                $context = $this->createContentContext($userWorkspace->getName());
            }
            $site = $context->getCurrentSite();
            $node = $this->nodeFactory->createFromNodeData($relatedNodeData, $context);
            $flowQuery = new FlowQuery([$node]);
            /** @var \Neos\ContentRepository\Domain\Model\NodeInterface $documentNode */
            $documentNode = $flowQuery->closest('[instanceof Neos.Neos:Document]')->get(0);
            $relatedNodes[] = new AssetUsageInNodeProperties($asset, $site, $documentNode, $node, $accessible);
        }
        $this->firstlevelCache[$assetIdentifier] = $relatedNodes;
        return $this->firstlevelCache[$assetIdentifier];
    }
AssetUsageInNodePropertiesStrategy