本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeInterface::hasProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeInterface::hasProperty方法的具体用法?PHP NodeInterface::hasProperty怎么用?PHP NodeInterface::hasProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Model\NodeInterface
的用法示例。
在下文中一共展示了NodeInterface::hasProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: matches
/**
* Returns TRUE if the given node has the property and the value is not empty.
*
* @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
* @return boolean
*/
public function matches(\TYPO3\TYPO3CR\Domain\Model\NodeInterface $node)
{
if ($node->hasProperty($this->propertyName)) {
$propertyValue = $node->getProperty($this->propertyName);
return !empty($propertyValue);
}
return FALSE;
}
示例2: evaluate
/**
* {@inheritdoc}
*
* @param FlowQuery $flowQuery the FlowQuery object
* @param array $arguments the arguments for this operation
* @return mixed|null if the operation is final, the return value
*/
public function evaluate(FlowQuery $flowQuery, array $arguments)
{
$imagePropertyName = $arguments[0];
if ($this->contextNode->hasProperty($imagePropertyName)) {
$image = $this->contextNode->getProperty($imagePropertyName);
if ($image instanceof ImageVariant) {
$image = $image->getOriginalAsset();
}
if ($image instanceof Image) {
$identifier = $image->getIdentifier();
$nodeData = $this->metaDataRepository->findOneByAssetIdentifier($identifier, $this->contextNode->getContext()->getWorkspace());
if ($nodeData instanceof NodeData) {
return $this->nodeFactory->createFromNodeData($nodeData, $this->contextNode->getContext());
}
}
}
return null;
}
示例3: extractComments
/**
* Extract comments and deserialize them
*
* @param NodeInterface|NodeData $nodeOrNodeData
* @return array
*/
protected function extractComments($nodeOrNodeData)
{
if ($nodeOrNodeData->hasProperty('comments')) {
$comments = $nodeOrNodeData->getProperty('comments');
if (is_string($comments) && strlen($comments) > 0) {
return json_decode($comments, TRUE);
}
}
return array();
}
示例4: setUniqueUriPathSegment
/**
* Sets the best possible uriPathSegment for the given Node.
* Will use an already set uriPathSegment or alternatively the node name as base,
* then checks if the uriPathSegment already exists on the same level and appends a counter until a unique path segment was found.
*
* @param NodeInterface $node
* @return void
*/
public static function setUniqueUriPathSegment(NodeInterface $node)
{
if ($node->getNodeType()->isOfType('TYPO3.Neos:Document')) {
$q = new FlowQuery(array($node));
$q = $q->context(array('invisibleContentShown' => true, 'removedContentShown' => true, 'inaccessibleContentShown' => true));
$possibleUriPathSegment = $initialUriPathSegment = !$node->hasProperty('uriPathSegment') ? $node->getName() : $node->getProperty('uriPathSegment');
$i = 1;
while ($q->siblings('[instanceof TYPO3.Neos:Document][uriPathSegment="' . $possibleUriPathSegment . '"]')->count() > 0) {
$possibleUriPathSegment = $initialUriPathSegment . '-' . $i++;
}
$node->setProperty('uriPathSegment', $possibleUriPathSegment);
}
}
示例5: getRequestPathByNode
/**
* Renders a request path based on the "uriPathSegment" properties of the nodes leading to the given node.
*
* @param NodeInterface $siteNode Top level node, corresponds to the top level of the request path
* @param NodeInterface $node The node where the generated path should lead to
* @return string A relative request path
* @throws Exception\MissingNodePropertyException if the given node doesn't have a "uriPathSegment" property set
*/
protected function getRequestPathByNode(NodeInterface $siteNode, NodeInterface $node)
{
if ($siteNode === $node) {
return '';
}
$requestPathSegments = array();
while ($siteNode !== $node && $node instanceof NodeInterface) {
if (!$node->hasProperty('uriPathSegment')) {
throw new Exception\MissingNodePropertyException(sprintf('Missing "uriPathSegment" property for node "%s". Nodes can be migrated with the "flow node:repair" command.', $node->getPath()), 1415020326);
}
$pathSegment = $node->getProperty('uriPathSegment');
$requestPathSegments[] = $pathSegment;
$node = $node->getParent();
}
return implode('/', array_reverse($requestPathSegments));
}
示例6: isTransformable
/**
* If the given node has no property this transformation should work on, this
* returns TRUE.
*
* @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
* @return boolean
*/
public function isTransformable(\TYPO3\TYPO3CR\Domain\Model\NodeInterface $node)
{
return !$node->hasProperty($this->newPropertyName);
}