2013-08-04 18:38:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class BlogCategoriesWidget extends Widget {
|
|
|
|
|
|
|
|
private static $title = "Categories";
|
|
|
|
|
|
|
|
private static $cmsTitle = "Blog Categories";
|
|
|
|
|
|
|
|
private static $description = "Displays a list of blog categories.";
|
|
|
|
|
|
|
|
private static $db = array();
|
|
|
|
|
|
|
|
private static $has_one = array(
|
|
|
|
"Blog" => "Blog",
|
|
|
|
);
|
|
|
|
|
|
|
|
public function getCMSFields() {
|
|
|
|
$fields = parent::getCMSFields();
|
2013-08-11 00:34:46 +02:00
|
|
|
$fields->push(DropdownField::create("BlogID", _t("BlogCategoriesWidget.Blog", "Blog"), Blog::get()->map()));
|
2013-08-04 18:38:26 +02:00
|
|
|
return $fields;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCategories() {
|
|
|
|
$blog = $this->Blog();
|
|
|
|
if($blog) {
|
|
|
|
return $blog->Categories();
|
|
|
|
}
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class BlogCategoriesWidget_Controller extends Widget_Controller {
|
|
|
|
|
|
|
|
}
|