Skip to content

Commit

Permalink
Add sorting for last modified or authored
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlagler committed Feb 9, 2024
1 parent 1338a09 commit 1eaa2a5
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions Content/ArticleDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ protected function getConfigurationBuilder(): BuilderInterface
['column' => 'created', 'title' => 'sulu_admin.created'],
['column' => 'title.raw', 'title' => 'sulu_admin.title'],
['column' => 'author_full_name.raw', 'title' => 'sulu_admin.author'],
['column' => 'last_modified_or_authored', 'title' => 'sulu_article.last_modified_or_authored'],
]
);

Expand Down
24 changes: 24 additions & 0 deletions Document/ArticleViewDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ class ArticleViewDocument implements ArticleViewDocumentInterface
*/
protected $authored;

/**
* @var \DateTime
*
* @Property(type="date")
*/
protected $lastModifiedOrAuthored;

/**
* @var string
*
Expand Down Expand Up @@ -511,6 +518,23 @@ public function setLastModified($lastModified)
return $this;
}

public function getLastModifiedOrAuthored(): \DateTime
{
return $this->lastModified ?? $this->authored;
}

/**
* @param \DateTime|null $lastModified
*
* @return $this|ArticleViewDocument
*/
public function setLastModifiedOrAuthored()

Check failure on line 531 in Document/ArticleViewDocument.php

View workflow job for this annotation

GitHub Actions / PHP Lint

PHPDoc tag @param references unknown parameter: $lastModified
{
$this->lastModifiedOrAuthored = $this->lastModified ?? $this->authored;

return $this;
}

public function getAuthored()
{
return $this->authored;
Expand Down
9 changes: 9 additions & 0 deletions Document/ArticleViewDocumentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,15 @@ public function getAuthored();
*/
public function setAuthored(\DateTime $authored = null);

/**
* Returns lastModified or authored date.
*
* @return \DateTime|null
*/
public function getLastModifiedOrAuthored();

public function setLastModifiedOrAuthored();

Check failure on line 299 in Document/ArticleViewDocumentInterface.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Method Sulu\Bundle\ArticleBundle\Document\ArticleViewDocumentInterface::setLastModifiedOrAuthored() has no return type specified.

/**
* Returns author full name.
*
Expand Down
1 change: 1 addition & 0 deletions Resources/translations/admin.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"sulu_article.published_state": "Status der Veröffentlichung",
"sulu_article.published": "Veröffentlicht",
"sulu_article.not_published": "Nicht Veröffentlicht",
"sulu_article.last_modified_or_authored": "Zuletzt geändert oder verfasst",
"sulu_activity.resource.articles": "Artikel",
"sulu_activity.resource.articles.translation": "Übersetzung",
"sulu_activity.description.articles.created": "{userFullName} hat den Artikel \"{resourceTitle}\" erstellt",
Expand Down
1 change: 1 addition & 0 deletions Resources/translations/admin.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"sulu_article.published_state": "Published State",
"sulu_article.published": "Published",
"sulu_article.not_published": "Not Published",
"sulu_article.last_modified_or_authored": "Last modified or authored",
"sulu_activity.resource.articles": "Article",
"sulu_activity.resource.articles.translation": "Translation",
"sulu_activity.description.articles.created": "{userFullName} has created the article \"{resourceTitle}\"",
Expand Down

0 comments on commit 1eaa2a5

Please sign in to comment.