当前位置: 首页>>代码示例>>PHP>>正文


PHP NodeTypeManager::getSubNodeTypes方法代码示例

本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Service\NodeTypeManager::getSubNodeTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeTypeManager::getSubNodeTypes方法的具体用法?PHP NodeTypeManager::getSubNodeTypes怎么用?PHP NodeTypeManager::getSubNodeTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\TYPO3CR\Domain\Service\NodeTypeManager的用法示例。


在下文中一共展示了NodeTypeManager::getSubNodeTypes方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: searchForNodeAction

 /**
  * @param string $searchWord
  * @param Site $selectedSite
  * @return void
  */
 public function searchForNodeAction($searchWord, Site $selectedSite = NULL)
 {
     $documentNodeTypes = $this->nodeTypeManager->getSubNodeTypes('TYPO3.Neos:Document');
     $shortcutNodeType = $this->nodeTypeManager->getNodeType('TYPO3.Neos:Shortcut');
     $nodeTypes = array_diff($documentNodeTypes, array($shortcutNodeType));
     $sites = array();
     $activeSites = $this->siteRepository->findOnline();
     foreach ($selectedSite ? array($selectedSite) : $activeSites as $site) {
         /** @var Site $site */
         $contextProperties = array('workspaceName' => 'live', 'currentSite' => $site);
         $contentDimensionPresets = $this->contentDimensionPresetSource->getAllPresets();
         if (count($contentDimensionPresets) > 0) {
             $mergedContentDimensions = array();
             foreach ($contentDimensionPresets as $contentDimensionIdentifier => $contentDimension) {
                 $mergedContentDimensions[$contentDimensionIdentifier] = array($contentDimension['default']);
                 foreach ($contentDimension['presets'] as $contentDimensionPreset) {
                     $mergedContentDimensions[$contentDimensionIdentifier] = array_merge($mergedContentDimensions[$contentDimensionIdentifier], $contentDimensionPreset['values']);
                 }
                 $mergedContentDimensions[$contentDimensionIdentifier] = array_values(array_unique($mergedContentDimensions[$contentDimensionIdentifier]));
             }
             $contextProperties['dimensions'] = $mergedContentDimensions;
         }
         /** @var ContentContext $liveContext */
         $liveContext = $this->contextFactory->create($contextProperties);
         $firstActiveDomain = $site->getFirstActiveDomain();
         $nodes = $this->nodeSearchService->findByProperties($searchWord, $nodeTypes, $liveContext, $liveContext->getCurrentSiteNode());
         if (count($nodes) > 0) {
             $sites[$site->getNodeName()] = array('site' => $site, 'domain' => $firstActiveDomain ? $firstActiveDomain->getHostPattern() : $this->request->getHttpRequest()->getUri()->getHost(), 'nodes' => $nodes);
         }
     }
     $this->view->assignMultiple(array('searchWord' => $searchWord, 'protocol' => $this->request->getHttpRequest()->getUri()->getScheme(), 'selectedSite' => $selectedSite, 'sites' => $sites, 'activeSites' => $activeSites));
 }
开发者ID:christophlehmann,项目名称:MOC.Varnish,代码行数:37,代码来源:VarnishCacheController.php

示例2: getNodeTypeFilterConstraints

 /**
  * @param QueryInterface $query
  * @param $nodeTypeFilter
  * @return array
  */
 protected function getNodeTypeFilterConstraints(QueryInterface $query, $nodeTypeFilter)
 {
     $includeNodeTypeConstraints = array();
     $excludeNodeTypeConstraints = array();
     $nodeTypeFilterParts = Arrays::trimExplode(',', $nodeTypeFilter);
     foreach ($nodeTypeFilterParts as $nodeTypeFilterPart) {
         $nodeTypeFilterPart = trim($nodeTypeFilterPart);
         if (strpos($nodeTypeFilterPart, '!') === 0) {
             $negate = true;
             $nodeTypeFilterPart = substr($nodeTypeFilterPart, 1);
         } else {
             $negate = false;
         }
         $nodeTypeFilterPartSubTypes = array_merge(array($nodeTypeFilterPart), $this->nodeTypeManager->getSubNodeTypes($nodeTypeFilterPart, false));
         foreach ($nodeTypeFilterPartSubTypes as $nodeTypeFilterPartSubType) {
             if ($negate === true) {
                 $excludeNodeTypeConstraints[] = $query->logicalNot($query->equals('nodeType', $nodeTypeFilterPartSubType));
             } else {
                 $includeNodeTypeConstraints[] = $query->equals('nodeType', $nodeTypeFilterPartSubType);
             }
         }
     }
     $constraints = $excludeNodeTypeConstraints;
     if (count($includeNodeTypeConstraints) > 0) {
         $constraints[] = $query->logicalOr($includeNodeTypeConstraints);
     }
     return $constraints;
 }
开发者ID:testbird,项目名称:neos-development-collection,代码行数:33,代码来源:NodeDataRepository.php

示例3: isNodeOfType

 /**
  * @param NodeInterface $node
  * @param NodeType $nodeType
  * @return boolean
  */
 public function isNodeOfType(NodeInterface $node, NodeType $nodeType)
 {
     if ($node->getNodeType()->getName() === $nodeType->getName()) {
         return true;
     }
     $subNodeTypes = $this->nodeTypeManager->getSubNodeTypes($nodeType->getName());
     return isset($subNodeTypes[$node->getNodeType()->getName()]);
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:13,代码来源:NodeService.php

示例4: indexAction

 /**
  * Shows a list of nodes
  *
  * @param string $searchTerm An optional search term used for filtering the list of nodes
  * @param string $workspaceName Name of the workspace to search in, "live" by default
  * @param array $dimensions Optional list of dimensions and their values which should be used for querying
  * @param array $nodeTypes A list of node types the list should be filtered by
  * @param NodeInterface $contextNode a node to use as context for the search
  * @return string
  */
 public function indexAction($searchTerm = '', $workspaceName = 'live', array $dimensions = array(), array $nodeTypes = array('TYPO3.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);
     $nodes = $this->nodeSearchService->findByProperties($searchTerm, $searchableNodeTypeNames, $contentContext, $contextNode);
     $this->view->assign('nodes', $nodes);
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:27,代码来源:NodesController.php

示例5: searchPageAction

 /**
  * Search a page, needed for internal links.
  *
  * @deprecated will be removed with 3.0, use Service/NodesController->indexAction() instead
  * @param string $query
  * @return void
  */
 public function searchPageAction($query)
 {
     $searchResult = array();
     $documentNodeTypes = $this->nodeTypeManager->getSubNodeTypes('TYPO3.Neos:Document');
     /** @var NodeInterface $node */
     foreach ($this->nodeSearchService->findByProperties($query, $documentNodeTypes, $this->createContext('live')) as $node) {
         $searchResult[$node->getPath()] = $this->processNodeForEditorPlugins($node);
     }
     $this->view->assign('value', array('searchResult' => $searchResult, 'success' => true));
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:17,代码来源:NodeController.php

示例6: generateNodeTypeSchema

 /**
  * The preprocessed node type schema contains everything we need for the UI:
  *
  * - "nodeTypes" contains the original (merged) node type schema
  * - "inheritanceMap.subTypes" contains for every parent type the transitive list of subtypes
  * - "constraints" contains for each node type, the list of allowed child node types; normalizing
  *   whitelists and blacklists:
  *   - [node type]
  *     - nodeTypes:
  *       [child node type name]: TRUE
  *     - childNodes:
  *       - [child node name]
  *         - nodeTypes:
  *          [child node type name]: TRUE
  *
  * @return array the node type schema ready to be used by the JavaScript code
  */
 public function generateNodeTypeSchema()
 {
     $schema = array('inheritanceMap' => array('subTypes' => array()), 'nodeTypes' => array(), 'constraints' => $this->generateConstraints());
     $nodeTypes = $this->nodeTypeManager->getNodeTypes(TRUE);
     /** @var NodeType $nodeType */
     foreach ($nodeTypes as $nodeTypeName => $nodeType) {
         if ($nodeType->isAbstract() === FALSE) {
             $configuration = $nodeType->getFullConfiguration();
             $this->flattenAlohaFormatOptions($configuration);
             $schema['nodeTypes'][$nodeTypeName] = $configuration;
             $schema['nodeTypes'][$nodeTypeName]['label'] = $nodeType->getLabel();
         }
         $schema['inheritanceMap']['subTypes'][$nodeTypeName] = array();
         foreach ($this->nodeTypeManager->getSubNodeTypes($nodeType->getName(), TRUE) as $subNodeType) {
             /** @var NodeType $subNodeType */
             $schema['inheritanceMap']['subTypes'][$nodeTypeName][] = $subNodeType->getName();
         }
     }
     return $schema;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:37,代码来源:NodeTypeSchemaBuilder.php

示例7: nodeIsOfType

 /**
  * @param string|array $nodeTypes
  * @return PropertyConditionGenerator
  */
 public function nodeIsOfType($nodeTypes)
 {
     $propertyConditionGenerator = new PropertyConditionGenerator('nodeType');
     if (!is_array($nodeTypes)) {
         $nodeTypes = array($nodeTypes);
     }
     $expandedNodeTypeNames = array();
     foreach ($nodeTypes as $nodeTypeName) {
         $subNodeTypes = $this->nodeTypeManager->getSubNodeTypes($nodeTypeName, false);
         $expandedNodeTypeNames = array_merge($expandedNodeTypeNames, array($nodeTypeName), array_keys($subNodeTypes));
     }
     return $propertyConditionGenerator->in(array_unique($expandedNodeTypeNames));
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:17,代码来源:ConditionGenerator.php

示例8: reorderChildNodesByNodeType

 /**
  * Reorder child nodes for the given node type
  *
  * @param NodeType $nodeType
  * @param string $workspaceName
  * @param boolean $dryRun
  * @return void
  */
 protected function reorderChildNodesByNodeType(NodeType $nodeType, $workspaceName, $dryRun)
 {
     $nodeTypes = $this->nodeTypeManager->getSubNodeTypes($nodeType->getName(), false);
     $nodeTypes[$nodeType->getName()] = $nodeType;
     if ($this->nodeTypeManager->hasNodeType((string) $nodeType)) {
         $nodeType = $this->nodeTypeManager->getNodeType((string) $nodeType);
         $nodeTypeNames[$nodeType->getName()] = $nodeType;
     } else {
         $this->output->outputLine('Node type "%s" does not exist', array((string) $nodeType));
         exit(1);
     }
     /** @var $nodeType NodeType */
     foreach ($nodeTypes as $nodeTypeName => $nodeType) {
         $childNodes = $nodeType->getAutoCreatedChildNodes();
         if ($childNodes === array()) {
             continue;
         }
         foreach ($this->getNodeDataByNodeTypeAndWorkspace($nodeTypeName, $workspaceName) as $nodeData) {
             /** @var NodeInterface $childNodeBefore */
             $childNodeBefore = null;
             $context = $this->nodeFactory->createContextMatchingNodeData($nodeData);
             $node = $this->nodeFactory->createFromNodeData($nodeData, $context);
             if (!$node instanceof NodeInterface) {
                 continue;
             }
             foreach ($childNodes as $childNodeName => $childNodeType) {
                 $childNode = $node->getNode($childNodeName);
                 if ($childNode) {
                     if ($childNodeBefore) {
                         if ($dryRun === false) {
                             if ($childNodeBefore->getIndex() >= $childNode->getIndex()) {
                                 $childNode->moveAfter($childNodeBefore);
                                 $this->output->outputLine('Moved node named "%s" after node named "%s" in "%s"', array($childNodeName, $childNodeBefore->getName(), $node->getPath()));
                             }
                         } else {
                             $this->output->outputLine('Should move node named "%s" after node named "%s" in "%s"', array($childNodeName, $childNodeBefore->getName(), $node->getPath()));
                         }
                     }
                 } else {
                     $this->output->outputLine('Missing child node named "%s" in "%s".', array($childNodeName, $node->getPath()));
                 }
                 $childNodeBefore = $childNode;
             }
         }
     }
 }
开发者ID:simonschaufi,项目名称:neos-development-collection,代码行数:54,代码来源:NodeCommandControllerPlugin.php

示例9: getPluginViewDefinitionByAction

 /**
  * Fetch a PluginView definition that matches the specified controller and action combination
  *
  * @param string $controllerObjectName
  * @param string $actionName
  * @return PluginViewDefinition
  * @throws Neos\Exception if more than one PluginView matches the given controller/action pair
  */
 public function getPluginViewDefinitionByAction($controllerObjectName, $actionName)
 {
     $pluginNodeTypes = $this->nodeTypeManager->getSubNodeTypes('TYPO3.Neos:Plugin', false);
     $matchingPluginViewDefinitions = array();
     foreach ($pluginNodeTypes as $pluginNodeType) {
         /** @var $pluginViewDefinition PluginViewDefinition */
         foreach ($this->getPluginViewDefinitionsByPluginNodeType($pluginNodeType) as $pluginViewDefinition) {
             if ($pluginViewDefinition->matchesControllerActionPair($controllerObjectName, $actionName) !== true) {
                 continue;
             }
             $matchingPluginViewDefinitions[] = $pluginViewDefinition;
         }
     }
     if (count($matchingPluginViewDefinitions) > 1) {
         throw new Neos\Exception(sprintf('More than one PluginViewDefinition found for controller "%s", action "%s":%s', $controllerObjectName, $actionName, chr(10) . implode(chr(10), $matchingPluginViewDefinitions)), 1377597671);
     }
     return count($matchingPluginViewDefinitions) > 0 ? current($matchingPluginViewDefinitions) : null;
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:26,代码来源:PluginService.php

示例10: getSubNodeTypesWithoutIncludeAbstractContainsNoAbstractNodeTypes

 /**
  * @test
  */
 public function getSubNodeTypesWithoutIncludeAbstractContainsNoAbstractNodeTypes()
 {
     $nodeTypes = $this->nodeTypeManager->getSubNodeTypes('TYPO3.TYPO3CR.Testing:ContentObject', false);
     $this->assertArrayNotHasKey('TYPO3.TYPO3CR.Testing:AbstractType', $nodeTypes);
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:8,代码来源:NodeTypeManagerTest.php


注:本文中的TYPO3\TYPO3CR\Domain\Service\NodeTypeManager::getSubNodeTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。