I'm using SheaDawson's blocks module, and I'm trying to create a "latest blog posts" content block. Here is my DataObject:
<?php
class LatestBlogPosts extends Block {
private static $db = array(
'ContainInGrid' => 'Boolean',
'PostCount' => 'Int'
);
static $defaults = array(
"PostCount" => 2
);
function getCMSFields() {
$fields = parent::getCMSFields();
return $fields;
}
public function LatestPosts() {
$blog = DataObject::get("BlogEntry", "", "Date DESC", "", $this->PostCount);
return $blog;
}
}
On the page template it's not displaying any posts. It says it can't find any. When I checked the database the BlogEntry table is empty, even though I have two posts that are published.
How do I fix this issue?