本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeInterface::getIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeInterface::getIdentifier方法的具体用法?PHP NodeInterface::getIdentifier怎么用?PHP NodeInterface::getIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Model\NodeInterface
的用法示例。
在下文中一共展示了NodeInterface::getIdentifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerNodePathChange
/**
* Schedules flushing of the routing cache entry for the given $nodeData
* Note: This is not done recursively because the nodePathChanged signal is triggered for any affected node data instance
*
* @param NodeInterface $node The affected node data instance
* @return void
*/
public function registerNodePathChange(NodeInterface $node)
{
if (in_array($node->getIdentifier(), $this->tagsToFlush)) {
return;
}
if (!$node->getNodeType()->isOfType('TYPO3.Neos:Document')) {
return;
}
$this->tagsToFlush[] = $node->getIdentifier();
}
示例2: setByPath
/**
* Adds the given node to the cache for the given path. The node
* will also be added under it's identifier.
*
* @param string $path
* @param NodeInterface $node
* @return void
*/
public function setByPath($path, NodeInterface $node = null)
{
$this->nodesByPath[$path] = $node;
if ($node !== null) {
$this->nodesByIdentifier[$node->getIdentifier()] = $node;
}
}
示例3: isDescendantNodeOf
/**
* @param string $nodePathOrIdentifier
* @return boolean
*/
public function isDescendantNodeOf($nodePathOrIdentifier)
{
if ($this->node === NULL) {
return TRUE;
}
if (preg_match(UuidValidator::PATTERN_MATCH_UUID, $nodePathOrIdentifier) === 1) {
if ($this->node->getIdentifier() === $nodePathOrIdentifier) {
return TRUE;
}
$node = $this->getNodeByIdentifier($nodePathOrIdentifier);
if ($node === NULL) {
return FALSE;
}
$nodePath = $node->getPath() . '/';
} else {
$nodePath = rtrim($nodePathOrIdentifier, '/') . '/';
}
return substr($this->node->getPath() . '/', 0, strlen($nodePath)) === $nodePath;
}
示例4: registerNodeChange
/**
* Register a node change for a later cache flush. This method is triggered by a signal sent via TYPO3CR's Node
* model or the Neos Publishing Service.
*
* @param NodeInterface $node The node which has changed in some way
* @return void
*/
public function registerNodeChange(NodeInterface $node)
{
$this->tagsToFlush[ContentCache::TAG_EVERYTHING] = 'which were tagged with "Everything".';
$nodeTypesToFlush = $this->getAllImplementedNodeTypes($node->getNodeType());
foreach ($nodeTypesToFlush as $nodeType) {
$nodeTypeName = $nodeType->getName();
$this->tagsToFlush['NodeType_' . $nodeTypeName] = sprintf('which were tagged with "NodeType_%s" because node "%s" has changed and was of type "%s".', $nodeTypeName, $node->getPath(), $node->getNodeType()->getName());
}
$this->tagsToFlush['Node_' . $node->getIdentifier()] = sprintf('which were tagged with "Node_%s" because node "%s" has changed.', $node->getIdentifier(), $node->getPath());
$originalNode = $node;
while ($node->getDepth() > 1) {
$node = $node->getParent();
// Workaround for issue #56566 in TYPO3.TYPO3CR
if ($node === null) {
break;
}
$tagName = 'DescendantOf_' . $node->getIdentifier();
$this->tagsToFlush[$tagName] = sprintf('which were tagged with "%s" because node "%s" has changed.', $tagName, $originalNode->getPath());
}
}
示例5: renderNode
private function renderNode(NodeInterface $node, ControllerContext $controllerContext)
{
$nodeInfo = ['contextPath' => $node->getContextPath(), 'name' => $node->getName(), 'identifier' => $node->getIdentifier(), 'nodeType' => $node->getNodeType()->getName(), 'properties' => $this->buildNodeProperties($node), 'label' => $node->getLabel(), 'isAutoCreated' => $node->isAutoCreated(), 'children' => []];
if ($node->getNodeType()->isOfType('TYPO3.Neos:Document')) {
$nodeInfo['uri'] = $this->uri($node, $controllerContext);
}
foreach ($node->getChildNodes() as $childNode) {
/* @var NodeInterface $childNode */
$nodeInfo['children'][] = ['contextPath' => $childNode->getContextPath(), 'nodeType' => $childNode->getNodeType()->getName()];
}
return $nodeInfo;
}
示例6: buildSingleItemJson
/**
* @param NodeInterface $article
* @return array
*/
protected function buildSingleItemJson(NodeInterface $article)
{
$contentCollection = $article->getChildNodes('TYPO3.Neos:ContentCollection')[0];
$articleBody = '';
if ($contentCollection instanceof NodeInterface) {
$content = $contentCollection->getChildNodes();
if (is_array($content) && array_key_exists(0, $content)) {
foreach ($content as $node) {
/** @var NodeInterface $node */
if ($node->getNodeType()->getName() === 'TYPO3.Neos.NodeTypes:Text' || $node->getNodeType()->getName() === 'TYPO3.Neos.NodeTypes:TextWithImage') {
$articleBody .= $node->getProperty('text');
}
}
}
}
$thumbnailConfiguration = new ThumbnailConfiguration(125, 125, 125, 125, true, true, false);
$detailConfiguration = new ThumbnailConfiguration(300, 300, 200, 200, true, true, false);
/** @var Image $image */
$image = $article->getProperty('headerImage');
$properties = ['@context' => 'http://schema.org', '@type' => 'Article', '@id' => $article->getIdentifier(), 'id' => $article->getIdentifier(), 'shortIdentifier' => explode('-', $article->getIdentifier())[0], 'title' => $article->getProperty('title'), 'articleBody' => $articleBody, 'publicationDate' => $article->getProperty('publicationDate')->format('D M d Y H:i:s O'), 'teaser' => $article->getProperty('article'), 'listImage' => $this->assetService->getThumbnailUriAndSizeForAsset($image, $thumbnailConfiguration)['src'], 'image' => $this->assetService->getThumbnailUriAndSizeForAsset($image, $detailConfiguration)['src']];
$this->processProperties($properties);
return $properties;
}
示例7: generateCacheTags
/**
* Generates cache tags to be flushed for a node which is flushed on shutdown.
*
* Code duplicated from Neos' ContentCacheFlusher class
*
* @param NodeInterface|NodeData $node The node which has changed in some way
* @return void
*/
protected function generateCacheTags($node)
{
$this->tagsToFlush[ContentCache::TAG_EVERYTHING] = 'which were tagged with "Everything".';
$nodeTypesToFlush = $this->getAllImplementedNodeTypes($node->getNodeType());
foreach ($nodeTypesToFlush as $nodeType) {
/** @var NodeType $nodeType */
$nodeTypeName = $nodeType->getName();
$this->tagsToFlush['NodeType_' . $nodeTypeName] = sprintf('which were tagged with "NodeType_%s" because node "%s" has changed and was of type "%s".', $nodeTypeName, $node->getPath(), $node->getNodeType()->getName());
}
$this->tagsToFlush['Node_' . $node->getIdentifier()] = sprintf('which were tagged with "Node_%s" because node "%s" has changed.', $node->getIdentifier(), $node->getPath());
while ($node->getDepth() > 1) {
$node = $node->getParent();
if ($node === NULL) {
break;
}
$this->tagsToFlush['DescendantOf_' . $node->getIdentifier()] = sprintf('which were tagged with "DescendantOf_%s" because node "%s" has changed.', $node->getIdentifier(), $node->getPath());
}
if ($node instanceof NodeInterface && $node->getContext() instanceof ContentContext) {
$firstActiveDomain = $node->getContext()->getCurrentSite()->getFirstActiveDomain();
if ($firstActiveDomain) {
$this->domainsToFlush[] = $firstActiveDomain->getHostPattern();
}
}
}
示例8: resolveNodePath
/**
* Resolves the given $nodePathOrIdentifier and returns its absolute path and or a boolean if the result directly matches the currently selected node
*
* @param string $nodePathOrIdentifier identifier or absolute path for the node to resolve
* @return bool|string TRUE if the node matches the selected node, FALSE if the corresponding node does not exist. Otherwise the resolved absolute path with trailing slash
*/
protected function resolveNodePath($nodePathOrIdentifier)
{
if ($this->node === null) {
return true;
}
if (preg_match(UuidValidator::PATTERN_MATCH_UUID, $nodePathOrIdentifier) !== 1) {
return rtrim($nodePathOrIdentifier, '/') . '/';
}
if ($this->node->getIdentifier() === $nodePathOrIdentifier) {
return true;
}
$node = $this->getNodeByIdentifier($nodePathOrIdentifier);
if ($node === null) {
return false;
}
return $node->getPath() . '/';
}
示例9: updateFulltext
/**
*
*
* @param NodeInterface $node
* @param array $fulltextIndexOfNode
* @param string $targetWorkspaceName
* @return void
*/
protected function updateFulltext(NodeInterface $node, array $fulltextIndexOfNode, $targetWorkspaceName = NULL)
{
if ($targetWorkspaceName !== NULL && $targetWorkspaceName !== 'live' || $node->getWorkspace()->getName() !== 'live' || count($fulltextIndexOfNode) === 0) {
return;
}
$closestFulltextNode = $node;
while (!$this->isFulltextRoot($closestFulltextNode)) {
$closestFulltextNode = $closestFulltextNode->getParent();
if ($closestFulltextNode === NULL) {
// root of hierarchy, no fulltext root found anymore, abort silently...
$this->logger->log('No fulltext root found for ' . $node->getPath(), LOG_WARNING);
return;
}
}
$closestFulltextNodeContextPath = str_replace($closestFulltextNode->getContext()->getWorkspace()->getName(), 'live', $closestFulltextNode->getContextPath());
$closestFulltextNodeContextPathHash = sha1($closestFulltextNodeContextPath);
$this->currentBulkRequest[] = array(array('update' => array('_type' => NodeTypeMappingBuilder::convertNodeTypeNameToMappingName($closestFulltextNode->getNodeType()->getName()), '_id' => $closestFulltextNodeContextPathHash)), array('script' => '
if (!ctx._source.containsKey("__fulltextParts")) {
ctx._source.__fulltextParts = new LinkedHashMap();
}
ctx._source.__fulltextParts[identifier] = fulltext;
ctx._source.__fulltext = new LinkedHashMap();
Iterator<LinkedHashMap.Entry<String, LinkedHashMap>> fulltextByNode = ctx._source.__fulltextParts.entrySet().iterator();
for (fulltextByNode; fulltextByNode.hasNext();) {
Iterator<LinkedHashMap.Entry<String, String>> elementIterator = fulltextByNode.next().getValue().entrySet().iterator();
for (elementIterator; elementIterator.hasNext();) {
Map.Entry<String, String> element = elementIterator.next();
String value;
if (ctx._source.__fulltext.containsKey(element.key)) {
value = ctx._source.__fulltext[element.key] + " " + element.value.trim();
} else {
value = element.value.trim();
}
ctx._source.__fulltext[element.key] = value;
}
}
', 'params' => array('identifier' => $node->getIdentifier(), 'fulltext' => $fulltextIndexOfNode), 'upsert' => array('__fulltext' => $fulltextIndexOfNode, '__fulltextParts' => array($node->getIdentifier() => $fulltextIndexOfNode)), 'lang' => 'groovy'));
}
示例10: setNode
/**
* Set the "context node" this operation was working on.
*
* @param NodeInterface $node
* @return void
*/
public function setNode(NodeInterface $node)
{
$this->nodeIdentifier = $node->getIdentifier();
$this->workspaceName = $node->getContext()->getWorkspaceName();
$this->dimension = $node->getContext()->getDimensions();
$context = $node->getContext();
if ($context instanceof ContentContext && $context->getCurrentSite() !== null) {
$siteIdentifier = $this->persistenceManager->getIdentifierByObject($context->getCurrentSite());
} else {
$siteIdentifier = null;
}
$this->data = Arrays::arrayMergeRecursiveOverrule($this->data, array('nodeContextPath' => $node->getContextPath(), 'nodeLabel' => $node->getLabel(), 'nodeType' => $node->getNodeType()->getName(), 'site' => $siteIdentifier));
$node = self::getClosestAggregateNode($node);
if ($node !== null) {
$this->documentNodeIdentifier = $node->getIdentifier();
$this->data = Arrays::arrayMergeRecursiveOverrule($this->data, array('documentNodeContextPath' => $node->getContextPath(), 'documentNodeLabel' => $node->getLabel(), 'documentNodeType' => $node->getNodeType()->getName()));
}
}
示例11: removeEventFromUser
/**
* @param NodeInterface $node
* @param array $data
* @param string $identifiersToCheck
* @param string $dataToClear
* @param string $exceptionMessage
*
* @throws \Exception
*/
protected function removeEventFromUser(NodeInterface $node, array &$data, $identifiersToCheck = 'personEventsIdentifiers', $dataToClear = 'personEvents', $exceptionMessage = '')
{
if (in_array($node->getIdentifier(), $data[$identifiersToCheck], true)) {
$keyToRemove = [];
foreach ($data[$dataToClear] as $key => $personEvent) {
/** @var NodeInterface $personEvent */
if ($personEvent->getIdentifier() === $node->getIdentifier()) {
$keyToRemove[] = $key;
} else {
continue;
}
}
if ($keyToRemove !== []) {
foreach ($keyToRemove as $key) {
unset($data[$dataToClear][$key]);
}
}
} else {
throw new \Exception($exceptionMessage, 12415423123.0);
}
}
示例12: getFullElasticSearchHitForNode
/**
* This low-level method can be used to look up the full ElasticSearch hit given a certain node.
*
* @param NodeInterface $node
* @return array the ElasticSearch hit for the node as array, or NULL if it does not exist.
*/
public function getFullElasticSearchHitForNode(NodeInterface $node)
{
if (isset($this->elasticSearchHitsIndexedByNodeFromLastRequest[$node->getIdentifier()])) {
return $this->elasticSearchHitsIndexedByNodeFromLastRequest[$node->getIdentifier()];
}
return null;
}
开发者ID:kdambekalns,项目名称:Flowpack.ElasticSearch.ContentRepositoryAdaptor,代码行数:13,代码来源:ElasticSearchQueryBuilder.php
示例13: addGenericEditingMetadata
/**
* Collects metadata attributes used to allow editing of the node in the Neos backend.
*
* @param array $attributes
* @param NodeInterface $node
* @return array
*/
protected function addGenericEditingMetadata(array $attributes, NodeInterface $node)
{
$attributes['typeof'] = 'typo3:' . $node->getNodeType()->getName();
$attributes['about'] = $node->getContextPath();
$attributes['data-node-_identifier'] = $node->getIdentifier();
$attributes['data-node-__workspace-name'] = $node->getWorkspace()->getName();
$attributes['data-node-__label'] = $node->getLabel();
if ($node->getNodeType()->isOfType('TYPO3.Neos:ContentCollection')) {
$attributes['rel'] = 'typo3:content-collection';
}
// these properties are needed together with the current NodeType to evaluate Node Type Constraints
// TODO: this can probably be greatly cleaned up once we do not use CreateJS or VIE anymore.
if ($node->getParent()) {
$attributes['data-node-__parent-node-type'] = $node->getParent()->getNodeType()->getName();
}
if ($node->isAutoCreated()) {
$attributes['data-node-_name'] = $node->getName();
$attributes['data-node-_is-autocreated'] = 'true';
}
if ($node->getParent() && $node->getParent()->isAutoCreated()) {
$attributes['data-node-_parent-is-autocreated'] = 'true';
// we shall only add these properties if the parent is actually auto-created; as the Node-Type-Switcher in the UI relies on that.
$attributes['data-node-__parent-node-name'] = $node->getParent()->getName();
$attributes['data-node-__grandparent-node-type'] = $node->getParent()->getParent()->getNodeType()->getName();
}
return $attributes;
}
示例14: wrapContentObject
/**
* Wrap the $content identified by $node with the needed markup for
* the backend.
* $parameters can be used to further pass parameters to the content element.
*
* @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
* @param string $typoscriptPath
* @param string $content
* @param boolean $isPage
* @return string
*/
public function wrapContentObject(\TYPO3\TYPO3CR\Domain\Model\NodeInterface $node, $typoscriptPath, $content, $isPage = FALSE)
{
$contentType = $node->getContentType();
$tagBuilder = new \TYPO3\Fluid\Core\ViewHelper\TagBuilder('div');
$tagBuilder->forceClosingTag(TRUE);
if (!$node->isRemoved()) {
$tagBuilder->setContent($content);
}
if (!$isPage) {
$cssClasses = array('t3-contentelement');
$cssClasses[] = str_replace(array(':', '.'), '-', strtolower($contentType->getName()));
if ($node->isHidden()) {
$cssClasses[] = 't3-contentelement-hidden';
}
if ($node->isRemoved()) {
$cssClasses[] = 't3-contentelement-removed';
}
$tagBuilder->addAttribute('class', implode(' ', $cssClasses));
$tagBuilder->addAttribute('id', 'c' . $node->getIdentifier());
}
try {
$this->accessDecisionManager->decideOnResource('TYPO3_TYPO3_Backend_BackendController');
} catch (\TYPO3\FLOW3\Security\Exception\AccessDeniedException $e) {
return $tagBuilder->render();
}
$tagBuilder->addAttribute('typeof', 'typo3:' . $contentType->getName());
$tagBuilder->addAttribute('about', $node->getContextPath());
$this->addScriptTag($tagBuilder, '__workspacename', $node->getWorkspace()->getName());
$this->addScriptTag($tagBuilder, '_removed', $node->isRemoved() ? 'true' : 'false', 'boolean');
$this->addScriptTag($tagBuilder, '_typoscriptPath', $typoscriptPath);
foreach ($contentType->getProperties() as $propertyName => $propertyConfiguration) {
$dataType = isset($propertyConfiguration['type']) ? $propertyConfiguration['type'] : 'string';
if ($propertyName[0] === '_') {
$propertyValue = \TYPO3\FLOW3\Reflection\ObjectAccess::getProperty($node, substr($propertyName, 1));
} else {
$propertyValue = $node->getProperty($propertyName);
}
// Serialize boolean values to String
if (isset($propertyConfiguration['type']) && $propertyConfiguration['type'] === 'boolean') {
$propertyValue = $propertyValue ? 'true' : 'false';
}
// Serialize date values to String
if ($propertyValue !== NULL && isset($propertyConfiguration['type']) && $propertyConfiguration['type'] === 'date') {
$propertyValue = $propertyValue->format('Y-m-d');
}
// Serialize objects to JSON strings
if (is_object($propertyValue) && $propertyValue !== NULL && isset($propertyConfiguration['type']) && $this->objectManager->isRegistered($propertyConfiguration['type'])) {
$gettableProperties = \TYPO3\FLOW3\Reflection\ObjectAccess::getGettableProperties($propertyValue);
$convertedProperties = array();
foreach ($gettableProperties as $key => $value) {
if (is_object($value)) {
$entityIdentifier = $this->persistenceManager->getIdentifierByObject($value);
if ($entityIdentifier !== NULL) {
$value = $entityIdentifier;
}
}
$convertedProperties[$key] = $value;
}
$propertyValue = json_encode($convertedProperties);
$dataType = 'jsonEncoded';
}
$this->addScriptTag($tagBuilder, $propertyName, $propertyValue, $dataType);
}
if (!$isPage) {
// add CSS classes
$this->addScriptTag($tagBuilder, '__contenttype', $contentType->getName());
} else {
$tagBuilder->addAttribute('id', 't3-page-metainformation');
$tagBuilder->addAttribute('data-__sitename', $this->nodeRepository->getContext()->getCurrentSite()->getName());
$tagBuilder->addAttribute('data-__siteroot', sprintf('/sites/%s@%s', $this->nodeRepository->getContext()->getCurrentSite()->getNodeName(), $this->nodeRepository->getContext()->getWorkspace()->getName()));
}
return $tagBuilder->render();
}
示例15: getACLPropertiesForNode
protected function getACLPropertiesForNode(NodeInterface $node)
{
$properties = ['nodeIdentifier' => $node->getIdentifier(), 'nodePath' => $node->getPath(), 'nodeLabel' => $node->getLabel(), 'nodeType' => $node->getNodeType()->getName(), 'nodeLevel' => $node->getDepth()];
return $properties;
}