old post view bug fix

This commit is contained in:
merdan 2021-06-21 12:21:19 +05:00
parent cc8ad52e3c
commit 605ce13beb
1 changed files with 9 additions and 2 deletions

View File

@ -39,9 +39,16 @@ class Views extends ComponentBase
protected function loadPost() protected function loadPost()
{ {
$slug = $this->property('slug'); $slug = $this->property('slug');
$post = BlogPost::isPublished()->where('slug', $slug)->first(); $post = new BlogPost;
$query = $post->isPublished();
return $post; if ($post->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')) {
$query->transWhere('slug', $slug);
} else {
$query->where('slug', $slug);
}
return $query->first();
} }
protected function getViews() protected function getViews()