diff --git a/Content/ArticleResourceItem.php b/Content/ArticleResourceItem.php index 5e73201bf..7c6f36b2b 100644 --- a/Content/ArticleResourceItem.php +++ b/Content/ArticleResourceItem.php @@ -110,6 +110,22 @@ public function getPublished(): \DateTime return $this->article->getPublished(); } + /** + * Returns isUpdated. + */ + public function getIsUpdated(): bool + { + return $this->article->getIsUpdated(); + } + + /** + * Returns updated. + */ + public function getUpdated(): ?\DateTime + { + return $this->article->getUpdated(); + } + /** * Returns authored. */ diff --git a/Document/ArticleDocument.php b/Document/ArticleDocument.php index f558216e8..da721c9c5 100644 --- a/Document/ArticleDocument.php +++ b/Document/ArticleDocument.php @@ -147,6 +147,16 @@ class ArticleDocument implements UuidBehavior, */ protected $changed; + /** + * @var bool + */ + protected $isUpdated; + + /** + * @var \DateTime|null + */ + protected $updated; + /** * @var int */ @@ -427,6 +437,26 @@ public function getAuthored() return $this->authored; } + public function setIsUpdated($isUpdated) + { + $this->isUpdated = $isUpdated; + } + + public function getIsUpdated() + { + return $this->isUpdated; + } + + public function setUpdated($updated) + { + $this->updated = $updated; + } + + public function getUpdated() + { + return $this->updated; + } + public function setAuthored($authored) { $this->authored = $authored; diff --git a/Document/ArticleViewDocument.php b/Document/ArticleViewDocument.php index dd77e24fd..4dce7bffd 100644 --- a/Document/ArticleViewDocument.php +++ b/Document/ArticleViewDocument.php @@ -168,6 +168,20 @@ class ArticleViewDocument implements ArticleViewDocumentInterface */ protected $seo; + /** + * @var bool + * + * @Property(type="boolean") + */ + protected $isUpdated; + + /** + * @var \DateTime|null + * + * @Property(type="date") + */ + protected $updated; + /** * @var \DateTime * @@ -484,6 +498,38 @@ public function setSeo(SeoViewObject $seo) return $this; } + public function getIsUpdated() + { + return $this->isUpdated; + } + + public function setIsUpdated($isUpdated) + { + $this->isUpdated = $isUpdated; + + return $this; + } + + /** + * @return \DateTime|null + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * @param \DateTime|null $updated + * + * @return $this|ArticleViewDocument + */ + public function setUpdated($updated) + { + $this->updated = $updated; + + return $this; + } + public function getAuthored() { return $this->authored; diff --git a/Document/ArticleViewDocumentInterface.php b/Document/ArticleViewDocumentInterface.php index ba73cfcbe..78e3f09cd 100644 --- a/Document/ArticleViewDocumentInterface.php +++ b/Document/ArticleViewDocumentInterface.php @@ -257,6 +257,38 @@ public function getSeo(); */ public function setSeo(SeoViewObject $seo); + /** + * Returns isUpdated. + * + * @return bool + */ + public function getIsUpdated(); + + /** + * Set updated date. + * + * @param bool $isUpdated + * + * @return $this + */ + public function setIsUpdated($isUpdated); + + /** + * Returns updated. + * + * @return \DateTime|null + */ + public function getUpdated(); + + /** + * Set updated date. + * + * @param \DateTime|null $updated + * + * @return $this + */ + public function setUpdated($updated); + /** * Returns authored. * diff --git a/Document/Form/ArticleDocumentType.php b/Document/Form/ArticleDocumentType.php index 56cea89ae..119f0d629 100644 --- a/Document/Form/ArticleDocumentType.php +++ b/Document/Form/ArticleDocumentType.php @@ -46,6 +46,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ] ); + $builder->add('isUpdated', CheckboxType::class); + $builder->add( + 'updated', + DateTimeType::class, + [ + 'widget' => 'single_text', + ] + ); $builder->add('author', TextType::class); $builder->add( 'authored', diff --git a/Document/Index/ArticleIndexer.php b/Document/Index/ArticleIndexer.php index 2fd4eecf2..0221e667a 100644 --- a/Document/Index/ArticleIndexer.php +++ b/Document/Index/ArticleIndexer.php @@ -186,6 +186,8 @@ protected function createOrUpdateArticle( $this->setParentPageUuid($document, $article); $article->setChanged($document->getChanged()); $article->setCreated($document->getCreated()); + $article->setIsUpdated($document->getIsUpdated()); + $article->setUpdated($document->getUpdated()); $article->setAuthored($document->getAuthored()); if ($document->getAuthor() && $author = $this->contactRepository->find($document->getAuthor())) { $article->setAuthorId($author->getId()); diff --git a/Resources/config/forms/article_settings.xml b/Resources/config/forms/article_settings.xml index f425626c9..7995bb4d5 100644 --- a/Resources/config/forms/article_settings.xml +++ b/Resources/config/forms/article_settings.xml @@ -107,6 +107,21 @@