/** * {@inheritdoc} */ public function remove(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey) { // if exist remove property of node if ($node->hasProperty($property->getName())) { $node->getProperty($property->getName())->remove(); } }
/** * {@inheritdoc} */ public function write(NodeInterface $node, PropertyInterface $property, $userId, $webspaceKey, $languageCode, $segmentKey) { $value = $property->getValue(); if ($value !== null && $value !== false && $value !== 'false' && $value !== '') { $node->setProperty($property->getName(), true); } else { $node->setProperty($property->getName(), false); } }
/** * {@inheritdoc} */ public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey) { $value = ''; if ($node->hasProperty($property->getName())) { /** @var \DateTime $propertyValue */ $propertyValue = $node->getPropertyValue($property->getName()); $value = $propertyValue->format('Y-m-d'); } $property->setValue($value); return $value; }
/** * {@inheritdoc} */ public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey) { $value = $this->defaultValue; if ($node->hasProperty($property->getName())) { $value = $node->getPropertyValue($property->getName()); } // the RedirectType subscriber sets the internal link as a reference if ($value instanceof NodeInterface) { $value = $value->getIdentifier(); } $property->setValue($value); return $value; }
public function testHasValue() { $type = new ContactSelectionContentType($this->template, $this->contactManager->reveal(), $this->accountManager->reveal(), $this->serializer->reveal(), new CustomerIdConverter(), new IndexComparator()); $this->property->getName()->willReturn('test'); $this->node->hasProperty('test')->willReturn(true); $this->assertTrue($type->hasValue($this->node->reveal(), $this->property->reveal(), $this->webspaceKey, $this->locale, $this->segmentKey)); }
/** * {@inheritdoc} */ public function write(NodeInterface $node, PropertyInterface $property, $userId, $webspaceKey, $languageCode, $segmentKey) { $value = $property->getValue(); if ($value !== null) { $node->setProperty($property->getName(), $this->removeValidation($this->removeIllegalCharacters($value))); } else { $this->remove($node, $property, $webspaceKey, $languageCode, $segmentKey); } }
/** * returns name of template. * * @return string */ public function getName() { return $this->block->getName() . '-' . $this->property->getName() . ($this->index !== null ? '#' . $this->index : ''); }
/** * {@inheritdoc} */ public function remove(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey) { foreach ($node->getProperties($property->getName() . '-*') as $nodeProperty) { $node->getProperty($nodeProperty->getName())->remove(); } }
/** * {@inheritdoc} */ public function remove(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey) { if ($node->hasProperty($property->getName())) { $property = $node->getProperty($property->getName()); $property->remove(); } }
/** * {@inheritdoc} */ public function hasValue(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey) { return $node->hasProperty($property->getName()); }
/** * {@inheritdoc} */ public function remove(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey = null) { $this->strategy->deleteByPath($property->getValue(), $webspaceKey, $languageCode, $segmentKey); if ($node->hasProperty($property->getName())) { $node->getProperty($property->getName())->remove(); } }
public function __construct(PropertyInterface $property, ContentTypeInterface $contentType) { parent::__construct(sprintf('Property "%s" is unexcepted in content type "%s"', $property->getName(), get_class($contentType))); $this->property = $property; $this->contentType = $contentType; }