Neos\Neos\Controller\Service\NodesController::indexAction PHP Метод

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

Shows a list of nodes
public indexAction ( string $searchTerm = '', array $nodeIdentifiers = [], string $workspaceName = 'live', array $dimensions = [], array $nodeTypes = ['Neos.Neos:Document'], Neos\ContentRepository\Domain\Model\NodeInterface $contextNode = null ) : string
$searchTerm string An optional search term used for filtering the list of nodes
$nodeIdentifiers array An optional list of node identifiers
$workspaceName string Name of the workspace to search in, "live" by default
$dimensions array Optional list of dimensions and their values which should be used for querying
$nodeTypes array A list of node types the list should be filtered by
$contextNode Neos\ContentRepository\Domain\Model\NodeInterface a node to use as context for the search
Результат string
    public function indexAction($searchTerm = '', array $nodeIdentifiers = array(), $workspaceName = 'live', array $dimensions = array(), array $nodeTypes = array('Neos.Neos:Document'), NodeInterface $contextNode = null)
    {
        $searchableNodeTypeNames = array();
        foreach ($nodeTypes as $nodeTypeName) {
            if (!$this->nodeTypeManager->hasNodeType($nodeTypeName)) {
                $this->throwStatus(400, sprintf('Unknown node type "%s"', $nodeTypeName));
            }
            $searchableNodeTypeNames[$nodeTypeName] = $nodeTypeName;
            /** @var NodeType $subNodeType */
            foreach ($this->nodeTypeManager->getSubNodeTypes($nodeTypeName, false) as $subNodeTypeName => $subNodeType) {
                $searchableNodeTypeNames[$subNodeTypeName] = $subNodeTypeName;
            }
        }
        $contentContext = $this->createContentContext($workspaceName, $dimensions);
        if ($nodeIdentifiers === array()) {
            $nodes = $this->nodeSearchService->findByProperties($searchTerm, $searchableNodeTypeNames, $contentContext, $contextNode);
        } else {
            $nodes = array_map(function ($identifier) use($contentContext) {
                return $contentContext->getNodeByIdentifier($identifier);
            }, $nodeIdentifiers);
        }
        $this->view->assign('nodes', $nodes);
    }