本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例5: getShadowLocale
private function getShadowLocale(NodeInterface $node, $locale)
{
return $node->getPropertyValueWithDefault($this->encoder->localizedSystemName(self::SHADOW_LOCALE_FIELD, $locale), null);
}
示例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);
}
示例7: load
/**
* {@inheritdoc}
*/
public function load(NodeInterface $node, $webspaceKey, $languageCode)
{
return ['a' => $node->getPropertyValueWithDefault($this->getPropertyName('a'), ''), 'b' => $node->getPropertyValueWithDefault($this->getPropertyName('b'), '')];
}
示例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;
}
示例9: getWorkflowStage
private function getWorkflowStage(NodeInterface $node, $locale)
{
$value = $node->getPropertyValueWithDefault($this->encoder->localizedSystemName(self::WORKFLOW_STAGE_FIELD, $locale), null);
return $value;
}
示例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);
}
示例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), []);
}
示例12: read
/**
* {@inheritdoc}
*/
public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
{
$tags = $this->tagManager->resolveTagIds($node->getPropertyValueWithDefault($property->getName(), []));
$property->setValue($tags);
}
示例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);
}
示例14: getPropertyValueWithDefault
/**
* {@inheritdoc}
*/
public function getPropertyValueWithDefault($relPath, $defaultValue)
{
return $this->node->getPropertyValueWithDefault($relPath, $defaultValue);
}
示例15: read
/**
* {@inheritdoc}
*/
public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
{
$categoryIds = $node->getPropertyValueWithDefault($property->getName(), []);
$this->setData($categoryIds, $property);
}