src/Sulu/Component/Content/Document/Subscriber/TitleSubscriber.php
public function setTitleOnDocument(AbstractMappingEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->supports($document)) {
            return;
        }

        if ($document instanceof LocalizedTitleBehavior) {
            if (!$event->getLocale()) {
                return;
            }

            $document->setTitle(
                $event->getNode()->getPropertyValueWithDefault(
                    $this->propertyEncoder->localizedContentName(static::PROPERTY_NAME, $event->getLocale()),
                    ''
                )
            );
        } else {
            $document->setTitle(
                $event->getNode()->getPropertyValueWithDefault(
                    $this->propertyEncoder->contentName(static::PROPERTY_NAME),
                    ''
                )
            );
        }
    }
public function setTitleOnDocument(AbstractMappingEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->supports($document)) {
            return;
        }

        if ($document instanceof LocalizedTitleBehavior) {
            if (!$event->getLocale()) {
                return;
            }

            $document->setTitle(
                $event->getNode()->getPropertyValueWithDefault(
                    $this->propertyEncoder->localizedContentName(static::PROPERTY_NAME, $event->getLocale()),
                    ''
                )
            );
        } else {
            $document->setTitle(
                $event->getNode()->getPropertyValueWithDefault(
                    $this->propertyEncoder->contentName(static::PROPERTY_NAME),
                    ''
                )
            );
        }
    }
public function setTitleOnDocument ( AbstractMappingEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } if ( $ document instanceof LocalizedTitleBehavior ) { if ( ! $ event -> getLocale ( ) ) { return ; } $ document -> setTitle ( $ event -> getNode ( ) -> getPropertyValueWithDefault ( $ this -> propertyEncoder -> localizedContentName ( static :: PROPERTY_NAME , $ event -> getLocale ( ) ) , '' ) ) ; } else { $ document -> setTitle ( $ event -> getNode ( ) -> getPropertyValueWithDefault ( $ this -> propertyEncoder -> contentName ( static :: PROPERTY_NAME ) , '' ) ) ; } }
Sets the title on the document from the node.

@param AbstractMappingEvent $event
Sets the title on the document from the node .