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


PHP NodeInterface::getPropertyValueWithDefault方法代码示例

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


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

示例1: testLoadWithoutData

 public function testLoadWithoutData()
 {
     $content = [];
     $this->node->getPropertyValueWithDefault(Argument::any(), Argument::any())->will(function ($arguments) use(&$content) {
         if (isset($content[$arguments[0]])) {
             return $content[$arguments[0]];
         } else {
             return $arguments[1];
         }
     });
     $this->extension->setLanguageCode('de', 'i18n', null);
     $result = $this->extension->load($this->node->reveal(), 'default', 'de');
     $this->assertEquals(['title' => '', 'description' => '', 'keywords' => '', 'canonicalUrl' => '', 'noIndex' => false, 'noFollow' => false, 'hideInSitemap' => false], $result);
 }
开发者ID:ollietb,项目名称:sulu,代码行数:14,代码来源:SeoStructureExtensionTest.php

示例2: read

 /**
  * {@inheritdoc}
  */
 public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     $data = $node->getPropertyValueWithDefault($property->getName(), '{}');
     if (is_string($data)) {
         $data = json_decode($data, true);
     }
     if (!empty($data['tags'])) {
         $data['tags'] = $this->tagManager->resolveTagIds($data['tags']);
     }
     $property->setValue($data);
 }
开发者ID:sulu,项目名称:sulu,代码行数:14,代码来源:ContentType.php

示例3: read

 /**
  * {@inheritdoc}
  */
 public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     $data = [];
     $categoryIds = $node->getPropertyValueWithDefault($property->getName(), []);
     $categories = $this->categoryManager->findByIds($categoryIds);
     $categories = $this->categoryManager->getApiObjects($categories, $languageCode);
     foreach ($categories as $category) {
         $data[] = $category->toArray();
     }
     $this->setData($data, $property);
 }
开发者ID:kriswillis,项目名称:sulu,代码行数:14,代码来源:CategoryList.php

示例4: read

 /**
  * {@inheritdoc}
  */
 public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     $value = $node->getPropertyValueWithDefault($property->getName(), $this->defaultValue);
     $property->setValue($this->validate($value, $languageCode));
     return $value;
 }
开发者ID:sulu,项目名称:sulu,代码行数:9,代码来源:TextEditor.php

示例5: getShadowLocale

 private function getShadowLocale(NodeInterface $node, $locale)
 {
     return $node->getPropertyValueWithDefault($this->encoder->localizedSystemName(self::SHADOW_LOCALE_FIELD, $locale), null);
 }
开发者ID:kriswillis,项目名称:sulu,代码行数:4,代码来源:ShadowLocaleSubscriber.php

示例6: loadProperty

 /**
  * load a single property value.
  *
  * @param NodeInterface $node
  * @param string        $name    name of property in node
  * @param string        $default value if no property exists with given name
  *
  * @return mixed
  */
 protected function loadProperty(NodeInterface $node, $name, $default = '')
 {
     return $node->getPropertyValueWithDefault($this->getPropertyName($name), $default);
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:13,代码来源:AbstractExtension.php

示例7: load

 /**
  * {@inheritdoc}
  */
 public function load(NodeInterface $node, $webspaceKey, $languageCode)
 {
     return ['a' => $node->getPropertyValueWithDefault($this->getPropertyName('a'), ''), 'b' => $node->getPropertyValueWithDefault($this->getPropertyName('b'), '')];
 }
开发者ID:kriswillis,项目名称:sulu,代码行数:7,代码来源:NodeRepositoryTest.php

示例8: hasSuluNodeType

 /**
  * Return true if the given node has the given
  * nodeType property (or properties).
  *
  * The sulu node type is the local name of node types
  * with the sulu namespace.
  *
  * Example:
  *   sulu:snippet is the PHPCR node type
  *   snippet is the Sulu node type
  *
  * @param NodeInterface $node
  * @param string|array  $suluNodeTypes One or more node sulu types
  *
  * @return bool
  */
 public function hasSuluNodeType($node, $suluNodeTypes)
 {
     foreach ((array) $suluNodeTypes as $suluNodeType) {
         if (in_array($suluNodeType, $node->getPropertyValueWithDefault('jcr:mixinTypes', []))) {
             return true;
         }
     }
     return false;
 }
开发者ID:sulu,项目名称:sulu,代码行数:25,代码来源:SuluNodeHelper.php

示例9: getWorkflowStage

 private function getWorkflowStage(NodeInterface $node, $locale)
 {
     $value = $node->getPropertyValueWithDefault($this->encoder->localizedSystemName(self::WORKFLOW_STAGE_FIELD, $locale), null);
     return $value;
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:5,代码来源:WorkflowStageSubscriber.php

示例10: read

 /**
  * {@inheritdoc}
  */
 public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     $data = json_decode($node->getPropertyValueWithDefault($property->getName(), '{}'), true);
     $this->setData($data, $property, $languageCode);
 }
开发者ID:kriswillis,项目名称:sulu,代码行数:8,代码来源:MediaSelectionContentType.php

示例11: getNavigationContext

 /**
  * Returns navigation context of given node and locale.
  *
  * @param NodeInterface $node
  * @param $locale
  *
  * @return array
  */
 private function getNavigationContext(NodeInterface $node, $locale)
 {
     return $node->getPropertyValueWithDefault(sprintf(self::NAVIGATION_CONTEXT_PROPERTY, $locale), []);
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:12,代码来源:ShadowCopyPropertiesSubscriber.php

示例12: read

 /**
  * {@inheritdoc}
  */
 public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     $tags = $this->tagManager->resolveTagIds($node->getPropertyValueWithDefault($property->getName(), []));
     $property->setValue($tags);
 }
开发者ID:sulu,项目名称:sulu,代码行数:8,代码来源:TagList.php

示例13: cleanup

 /**
  * Cleanup specific node and his children.
  *
  * @param NodeInterface $node
  * @param string        $rootPath
  * @param bool          $dryRun
  */
 private function cleanup(OutputInterface $output, NodeInterface $node, $rootPath, $dryRun)
 {
     foreach ($node->getNodes() as $childNode) {
         $this->cleanup($output, $childNode, $rootPath, $dryRun);
     }
     $path = ltrim(str_replace($rootPath, '', $node->getPath()), '/');
     if (!$node->getPropertyValueWithDefault('sulu:history', false)) {
         $output->writeln('<info>Processing aborted: </info>/' . $path . ' <comment>(no history url)</comment>');
         return;
     }
     if ($dryRun === false) {
         $node->remove();
     }
     $output->writeln('<info>Processing: </info>/' . $path);
 }
开发者ID:sulu,项目名称:sulu,代码行数:22,代码来源:CleanupHistoryCommand.php

示例14: getPropertyValueWithDefault

 /**
  * {@inheritdoc}
  */
 public function getPropertyValueWithDefault($relPath, $defaultValue)
 {
     return $this->node->getPropertyValueWithDefault($relPath, $defaultValue);
 }
开发者ID:sulu,项目名称:sulu,代码行数:7,代码来源:SuluNode.php

示例15: read

 /**
  * {@inheritdoc}
  */
 public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     $categoryIds = $node->getPropertyValueWithDefault($property->getName(), []);
     $this->setData($categoryIds, $property);
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:8,代码来源:CategoryList.php


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