當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。