Sulu\Component\Content\SimpleContentType::write PHP Метод

write() публичный Метод

public write ( PHPCR\NodeInterface $node, Sulu\Component\Content\Compat\PropertyInterface $property, $userId, $webspaceKey, $languageCode, $segmentKey )
$node PHPCR\NodeInterface
$property Sulu\Component\Content\Compat\PropertyInterface
    public function write(NodeInterface $node, PropertyInterface $property, $userId, $webspaceKey, $languageCode, $segmentKey)
    {
        $value = $property->getValue();
        if ($value != null) {
            $node->setProperty($property->getName(), $this->removeIllegalCharacters($this->encodeValue($value)));
        } else {
            $this->remove($node, $property, $webspaceKey, $languageCode, $segmentKey);
        }
    }

Usage Example

Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function write(NodeInterface $node, PropertyInterface $property, $userId, $webspaceKey, $languageCode, $segmentKey)
 {
     $value = $property->getValue();
     if ($node->getIdentifier() !== null && $value === $node->getIdentifier()) {
         throw new \InvalidArgumentException('Internal link node cannot reference itself');
     }
     parent::write($node, $property, $userId, $webspaceKey, $languageCode, $segmentKey);
 }