Set page-title on persist event.

@param PersistEvent $event
493971
public function setPageTitleOnPersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleInterface) {
            return;
        }

        $document->setPageTitle($this->getPageTitle($document));
    }
1319195
public void setPersistentItems(boolean persist)  {
        addField(ConfigureNodeFields.persist_items, FormField.Type.bool);
        setAnswer(ConfigureNodeFields.persist_items.getFieldName(), persist);
    }
473545
public function set_title($title) {
        $title = format_string($title);
        $title = strip_tags($title);
        $title = str_replace('"', '&quot;', $title);
        $this->_title = $title;
    }
822401
public function createNodeInPublicWorkspace(PersistEvent $event)
    {
        $node = $event->getNode();

        if ($node->isNew()) {
            $this->createNodesWithUuid($node);

            return;
        }

        $liveNode = $this->getLiveNode($event->getDocument());
        $nodeName = $node->getName();

        if ($liveNode->getName() !== $nodeName) {
            $liveNode->rename($nodeName);
        }
    }
1152066
public static function onBeforeSave(Event $event)
    {
        $layout = $event->getTarget();
        if (!is_a($layout, 'BackBee\Site\Layout')) {
            return;
        }

        $dispatcher = $event->getDispatcher();
        if (null !== $dispatcher->getApplication()) {
            if (is_a($event->getEventArgs(), 'Doctrine\ORM\Event\PreUpdateEventArgs')) {
                if (!$event->getEventArgs()->hasChangedField('_data')) {
                    return;
                }
            }

            // Update the layout thumbnail - Beware of generate thumbnail before any other operation
            $thumb = $dispatcher->getApplication()->getEntityManager()
                    ->getRepository('BackBee\Site\Layout')
                    ->generateThumbnail($layout, $dispatcher->getApplication());

            // Update the layout file
            try {
                $dispatcher->getApplication()->getRenderer()->updateLayout($layout);
            } catch (\BackBee\Renderer\Exception\RendererException $e) {
                $dispatcher->getApplication()->warning($e->getMessage());
            }

            if (is_a($event->getEventArgs(), 'Doctrine\ORM\Event\PreUpdateEventArgs')) {
                if ($event->getEventArgs()->hasChangedField('_picpath')) {
                    $event->getEventArgs()->setNewValue('_picpath', $thumb);
                }
            }
        }
    }
12541
public function setPageTitle(array $config): void
    {
        foreach ($config as $item) {
            if (isset($item['active']) && $item['active']) {
                $this->_View->assign('title', $item['title']);
                break;
            }
        }
    }
715469
public void setTitle(String title) {
        put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE));
    }
118184
public function setTitle($title)
    {

        if (!empty($title)) {
            $this->title = $title;
        } else if (isset($this->title)) {
            unset($this->title);
        }

    }
1298989
public static function onFlushPage(Event $event)
    {
        $em = $event->getApplication()->getEntityManager();
        $uow = $em->getUnitOfWork();
        $page = $event->getTarget();
        if ($uow->isScheduledForInsert($page) && $page->getParent() !== null && $page->getState() < 4) {
            self::setSectionHasChildren($em, $page->getParent()->getSection(), +1);
        }
    }
1312543
public function setTitle($title)
    {
        if (gettype($title) === 'string') {
            $this->title = $title;
        } else {
            $msg = "Title must be a string, '" . gettype($title) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
1186380
public function handleSetParentNode(PersistEvent $event)
    {
        if (!$event->getDocument() instanceof DateShardingBehavior || $event->hasParentNode()) {
            return;
        }

        $date = $event->getDocument()->getCreated();
        if (null === $date) {
            $date = new \DateTime();
        }

        $path = $this->pathBuilder->build(['%base%', '%articles%', $date->format('Y'), $date->format('m')]);

        $event->setParentNode($this->nodeManager->createPath($path));
    }
658502
public function handlePersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$event->getOption('auto_name') || !$document instanceof AutoNameBehavior || $event->hasNode()) {
            return;
        }

        $parentNode = $event->getParentNode();
        $name = $this->getName($document, $parentNode, $event->getOption('auto_rename'));
        $node = $parentNode->addNode($name);
        $event->setNode($node);
    }
814049
public function handleChildrenPersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        foreach ($document->getChildren() as $childDocument) {
            if (!$childDocument instanceof ArticlePageDocument) {
                continue;
            }

            $localizationState = $this->documentInspector->getLocalizationState($childDocument);

            if (LocalizationState::GHOST === $localizationState) {
                continue;
            }

            $changed = false;

            if ($document->getStructureType() !== $childDocument->getStructureType()) {
                $childDocument->setStructureType($document->getStructureType());
                $changed = true;
            }

            if ($document->getShadowLocale() !== $childDocument->getShadowLocale()) {
                $childDocument->setShadowLocale($document->getShadowLocale());
                $changed = true;
            }

            if ($document->isShadowLocaleEnabled() !== $childDocument->isShadowLocaleEnabled()) {
                $childDocument->setShadowLocaleEnabled($document->isShadowLocaleEnabled());
                $changed = true;
            }

            if ($changed) {
                $this->documentManager->persist(
                    $childDocument,
                    $childDocument->getLocale(),
                    [
                        'clear_missing_content' => false,
                        'auto_name' => false,
                        'auto_rename' => false,
                    ]
                );
            }
        }
    }
57616
public function onBeforeAddPageCommit(BeforeAddPageCommitEvent $event)
    {
        if ($event->isAborted()) {
            return;
        }

        $pageManager = $event->getContentManager();
        $templateManager = $pageManager->getTemplateManager();
        $pageRepository = $pageManager->getPageRepository();

        try {
            $languages = $this->languageRepository->activeLanguages();
            if (count($languages) > 0) {
                $result = true;
                $templateManager->getBlockRepository()->setConnection($pageRepository->getConnection());
                $pageRepository->startTransaction();
                // The min number of pages is setted to 1 because we are adding a page which has been saved but not
                // committed so it counts as one
                $ignoreRepeatedSlots = $pageManager->getValidator()->hasPages(1);
                $idPage = $pageManager->get()->getId();
                foreach ($languages as $alLanguage) {
                    $result = $templateManager->populate($alLanguage->getId(), $idPage, $ignoreRepeatedSlots);

                    if ($result === false) break;
                }

                if ($result === false) {
                    $pageRepository->rollBack();

                    $event->abort();
                } else {
                    $pageRepository->commit();
                }
            }
        } catch (\Exception $e) {
            $event->abort();
            if (isset($pageRepository) && $pageRepository !== null) {
                $pageRepository->rollBack();
            }

            throw $e;
        }
    }
780049
public static function onPreUpdate(Event $event)
    {
        $page = $event->getTarget();
        $eventArgs = $event->getEventArgs();
        $updateParents = false;
        $new = $old = null;

        $pageCountModifier = -1;
        if ($eventArgs instanceof PreUpdateEventArgs) {
            if ($page instanceof Page && $eventArgs->hasChangedField('_section')) {
                $old = $eventArgs->getOldValue('_section');
                $new = $eventArgs->getNewValue('_section');

                if ($new->getUid() === $page->getUid()) {
                    return;
                }
                $updateParents = true;
            }

            if ($page instanceof Page && $eventArgs->hasChangedField('_state')) {
                if ($page->getParent() !== null) {
                    if ($eventArgs->getNewValue('_state') >= 4) {
                        $old = $page->getParent()->getSection();
                        if (!$page->isLeaf()) {
                            $pageCountModifier = 0;
                        }
                    } else {
                        $new = $page->getParent()->getSection();
                    }
                    $updateParents = true;
                }
            }

            if ($page instanceof Section && $eventArgs->hasChangedField('_parent')) {
                $old = $eventArgs->getOldValue('_parent');
                $new = $eventArgs->getNewValue('_parent');
                $updateParents = true;
            }

            if ($updateParents) {
                $em = $event->getApplication()->getEntityManager();

                self::setSectionHasChildren($em, $old, $pageCountModifier);
                self::setSectionHasChildren($em, $new, +1);
            }
        }
    }
38717
public function setNodeOnPersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument || $event->hasNode()) {
            return;
        }

        $pageTitle = $this->getPageTitle($document);

        // if no page-title exists use a unique-id
        $nodeName = $this->slugifier->slugify($pageTitle ?: uniqid('page-', true));
        $nodeName = $this->resolver->resolveName($event->getParentNode(), $nodeName);
        $node = $event->getParentNode()->addNode($nodeName);

        $event->setNode($node);
    }
85211
public function setEvent($event)
  {
    if ($event === '?' || $event === '') {
      $this->event = null;
    } else {
      $event = Util::foreignLettersToEnglishLetters($event);
      $event = Util::titleCaseIfCurrentlyAllCaps($event);
      $this->event = $event === '?' ? null : $event;
    }
  }