Exemple #1
0
 /**
  * Sets the title on the node from the value in the document.
  *
  * @param PersistEvent $event
  */
 public function setTitleOnNode(AbstractMappingEvent $event)
 {
     $document = $event->getDocument();
     if (!$this->supports($document)) {
         return;
     }
     if ($document instanceof LocalizedTitleBehavior) {
         if (!$event->getLocale()) {
             return;
         }
         $event->getNode()->setProperty($this->propertyEncoder->localizedContentName(static::PROPERTY_NAME, $event->getLocale()), $document->getTitle());
     } else {
         $event->getNode()->setProperty($this->propertyEncoder->contentName(static::PROPERTY_NAME), $document->getTitle());
     }
 }
Exemple #2
0
 private function getStructureTypePropertyName($document, $locale)
 {
     if ($document instanceof LocalizedStructureBehavior) {
         return $this->encoder->localizedSystemName(self::STRUCTURE_TYPE_FIELD, $locale);
     }
     // TODO: This is the wrong namespace, it should be the system namespcae, but we do this for initial BC
     return $this->encoder->contentName(self::STRUCTURE_TYPE_FIELD);
 }