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


PHP NodeInterface::getProperty方法代码示例

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


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

示例1: resolveShortcutTarget

 /**
  * Resolves a shortcut node to the target. The return value can be
  *
  * * a NodeInterface instance if the target is a node or a node:// URI
  * * a string (in case the target is a plain text URI or an asset:// URI)
  * * NULL in case the shortcut cannot be resolved
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
  * @return NodeInterface|string|NULL
  */
 public function resolveShortcutTarget(NodeInterface $node)
 {
     $infiniteLoopPrevention = 0;
     while ($node->getNodeType()->isOfType('TYPO3.Neos:Shortcut') && $infiniteLoopPrevention < 50) {
         $infiniteLoopPrevention++;
         switch ($node->getProperty('targetMode')) {
             case 'selectedTarget':
                 $target = $node->getProperty('target');
                 if ($this->linkingService->hasSupportedScheme($target)) {
                     $targetObject = $this->linkingService->convertUriToObject($target, $node);
                     if ($targetObject instanceof NodeInterface) {
                         $node = $targetObject;
                     } elseif ($targetObject instanceof AssetInterface) {
                         return $this->linkingService->resolveAssetUri($target);
                     }
                 } else {
                     return $target;
                 }
                 break;
             case 'parentNode':
                 $node = $node->getParent();
                 break;
             case 'firstChildNode':
             default:
                 $childNodes = $node->getChildNodes('TYPO3.Neos:Document');
                 if ($childNodes !== array()) {
                     $node = reset($childNodes);
                 } else {
                     return null;
                 }
         }
     }
     return $node;
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:44,代码来源:NodeShortcutResolver.php

示例2: trackAction

 /**
  * Increase read counter of the node by one
  *
  * @param NodeInterface $node Node to increase the read counter for
  *
  * @throws BadRequestException
  * @return mixed[]
  */
 public function trackAction(NodeInterface $node)
 {
     // we can only count pages that include the mixin
     if ($node->getNodeType()->isOfType('Futjikato.ReadCounter:CounterMixin')) {
         $node->setProperty('readcounter', $node->getProperty('readcounter') + 1);
         /**
          * Action changes data but is accessible via GET. this issues a error if we do not manually
          * persists the object in the persistence manager
          */
         $this->persistenceManager->persistAll();
         // by default the flow JSON view uses the 'value' variable
         $this->view->assign('value', array('readcounter' => $node->getProperty('readcounter')));
     } else {
         throw new BadRequestException('Node does not contain Futjikato.ReadCounter:CounterMixin.');
     }
 }
开发者ID:futjikato,项目名称:ReadCounter,代码行数:24,代码来源:TrackingController.php

示例3: fetchVimeoThumb

 /**
  * Fetch thumb url from Vimeo API
  *
  * @param NodeInterface $node
  * @return void
  */
 public function fetchVimeoThumb(NodeInterface $node)
 {
     $fullVideo = $node->getProperty('fullVideo');
     $fullVideoThumb = $node->getProperty('fullVideoThumb');
     if ($fullVideo && !$fullVideoThumb) {
         $url = 'https://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/' . $fullVideo;
         $content = file_get_contents($url);
         $json = json_decode($content, true);
         $node->setProperty('fullVideoThumb', $json['thumbnail_url']);
     } else {
         if (!$fullVideo && $fullVideoThumb) {
             // Clear thumb, if Vimeo video is gone. Useful for reloading thumb.
             $node->setProperty('fullVideoThumb', '');
         }
     }
 }
开发者ID:alexkuklin,项目名称:EncultDistr,代码行数:22,代码来源:VimeoService.php

示例4: 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;
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:14,代码来源:PropertyNotEmpty.php

示例5: 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;
 }
开发者ID:neos,项目名称:metadata-contentrepositoryadapter,代码行数:25,代码来源:MetaDataOperation.php

示例6: setDefaultValues

 /**
  * Sets default node property values on the given node.
  *
  * @param NodeInterface $node
  * @return void
  */
 public function setDefaultValues(NodeInterface $node)
 {
     $nodeType = $node->getNodeType();
     foreach ($nodeType->getDefaultValuesForProperties() as $propertyName => $defaultValue) {
         if (trim($node->getProperty($propertyName)) === '') {
             $node->setProperty($propertyName, $defaultValue);
         }
     }
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:15,代码来源:NodeService.php

示例7: getDisplayName

 /**
  * @param NodeInterface $profileNode
  * @return string
  */
 public function getDisplayName(NodeInterface $profileNode)
 {
     $return = '';
     if ($profileNode->getProperty('firstName')) {
         $return .= ucfirst($profileNode->getProperty('firstName'));
     }
     if ($profileNode->getProperty('lastName')) {
         $lastNameParts = explode(' ', $profileNode->getProperty('lastName'));
         $return .= ' ';
         $lastName = ucfirst(end($lastNameParts));
         array_pop($lastNameParts);
         $lastNameParts[] = $lastName;
         foreach ($lastNameParts as $namePart) {
             $return .= $namePart . ' ';
         }
     }
     return $return;
 }
开发者ID:keen-vantage,项目名称:BuJitsuDo.Authentication,代码行数:22,代码来源:ProfileHelper.php

示例8: 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();
 }
开发者ID:sandstorm,项目名称:contentcomments,代码行数:16,代码来源:WorkspaceAspect.php

示例9: render

 /**
  * Check if user is already registered for an event.
  *
  * @param NodeInterface $event
  * @param NodeInterface $person
  *
  * @return string
  */
 public function render(NodeInterface $event, NodeInterface $person = null)
 {
     $authenticationProviderName = $this->authenticationManagerInterface->getSecurityContext()->getAccount()->getAuthenticationProviderName();
     if ($authenticationProviderName === 'Typo3BackendProvider') {
         return $this->renderElseChild();
     }
     if ($person === null) {
         $person = $this->profileService->getCurrentPartyProfile();
     }
     $eventAttendees = $event->getProperty('attendees') ? $event->getProperty('attendees') : [];
     $eventAttendeesIdentifiers = [];
     foreach ($eventAttendees as $eventAttendee) {
         /* @var NodeInterface $eventAttendee */
         $eventAttendeesIdentifiers[] = $eventAttendee->getIdentifier();
     }
     if (in_array($person->getIdentifier(), $eventAttendeesIdentifiers, true)) {
         return $this->renderThenChild();
     }
     return $this->renderElseChild();
 }
开发者ID:keen-vantage,项目名称:BJD.Events,代码行数:28,代码来源:IsRegisteredForEventViewHelper.php

示例10: 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);
     }
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:21,代码来源:NodeUriPathSegmentGenerator.php

示例11: 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;
 }
开发者ID:keen-vantage,项目名称:BuJitsuDo.Api,代码行数:27,代码来源:NewsService.php

示例12: sendNewCommentNotification

 /**
  * Send a new notification that a comment has been created
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $commentNode The comment node
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $postNode The post node
  * @return void
  */
 public function sendNewCommentNotification(NodeInterface $commentNode, NodeInterface $postNode)
 {
     if ($this->settings['notifications']['to']['email'] === '') {
         return;
     }
     if (!class_exists('TYPO3\\SwiftMailer\\Message')) {
         $this->systemLogger->logException(new \TYPO3\Flow\Exception('The package "TYPO3.SwiftMailer" is required to send notifications!', 1359473932));
         return;
     }
     try {
         $mail = new Message();
         $mail->setFrom(array($commentNode->getProperty('emailAddress') => $commentNode->getProperty('author')))->setTo(array($this->settings['notifications']['to']['email'] => $this->settings['notifications']['to']['name']))->setSubject('New comment on blog post "' . $postNode->getProperty('title') . '"' . ($commentNode->getProperty('spam') ? ' (SPAM)' : ''))->setBody($commentNode->getProperty('text'))->send();
     } catch (\Exception $e) {
         $this->systemLogger->logException($e);
     }
 }
开发者ID:rotespferd,项目名称:Mariansievers.Plugin.News,代码行数:23,代码来源:NotificationService.php

示例13: generateCss

 /**
  * Generate CSS styles from spacing* properties
  *
  * @param NodeInterface $node
  * @return string
  */
 public function generateCss(NodeInterface $node)
 {
     $css = '';
     foreach (self::PROPERTY_MAPPING as $key => $cssProperty) {
         // Get value, also check for `0` values using strlen()
         if (($value = $node->getProperty($key)) || strlen($value)) {
             // if numeric value is provided, add default unit (e.g. px)
             // but don't add it to zero values
             if ($value && is_numeric($value)) {
                 $value .= self::DEFAULT_UNIT;
             }
             $css .= "{$cssProperty}:{$value};";
         }
     }
     return $css;
 }
开发者ID:simonschaufi,项目名称:M12.Foundation,代码行数:22,代码来源:SpacingHelper.php

示例14: getPluginNamespace

 /**
  * Returns the plugin namespace that will be prefixed to plugin parameters in URIs.
  * By default this is <plugin_class_name>
  *
  * @return string
  */
 protected function getPluginNamespace()
 {
     if ($this->getArgumentNamespace() !== NULL) {
         return $this->getArgumentNamespace();
     }
     if ($this->node instanceof NodeInterface) {
         $nodeArgumentNamespace = $this->node->getProperty('argumentNamespace');
         if ($nodeArgumentNamespace !== NULL) {
             return $nodeArgumentNamespace;
         }
         $nodeArgumentNamespace = $this->node->getNodeType()->getName();
         $nodeArgumentNamespace = str_replace(':', '-', $nodeArgumentNamespace);
         $nodeArgumentNamespace = str_replace('.', '_', $nodeArgumentNamespace);
         $nodeArgumentNamespace = strtolower($nodeArgumentNamespace);
         return $nodeArgumentNamespace;
     }
     $argumentNamespace = str_replace(array(':', '.', '\\'), array('_', '_', '_'), $this->getPackage() . '_' . $this->getSubpackage() . '-' . $this->getController());
     $argumentNamespace = strtolower($argumentNamespace);
     return $argumentNamespace;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:26,代码来源:PluginImplementation.php

示例15: evaluate

 /**
  * Returns the rendered content of this plugin
  *
  * @return string The rendered content as a string
  * @throws StopActionException
  */
 public function evaluate()
 {
     $currentContext = $this->tsRuntime->getCurrentContext();
     $this->pluginViewNode = $currentContext['node'];
     /** @var $parentResponse Response */
     $parentResponse = $this->tsRuntime->getControllerContext()->getResponse();
     $pluginResponse = new Response($parentResponse);
     $pluginRequest = $this->buildPluginRequest();
     if ($pluginRequest->getControllerObjectName() === '') {
         $message = 'Master View not selected';
         if ($this->pluginViewNode->getProperty('plugin')) {
             $message = 'Plugin View not selected';
         }
         if ($this->pluginViewNode->getProperty('view')) {
             $message = 'Master View or Plugin View not found';
         }
         return $this->pluginViewNode->getContext()->getWorkspaceName() !== 'live' || $this->objectManager->getContext()->isDevelopment() ? '<p>' . $message . '</p>' : '<!-- ' . $message . '-->';
     }
     $this->dispatcher->dispatch($pluginRequest, $pluginResponse);
     return $pluginResponse->getContent();
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:27,代码来源:PluginViewImplementation.php


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