old post view bug fix
This commit is contained in:
parent
cc8ad52e3c
commit
605ce13beb
|
|
@ -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()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue