mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-07-01 00:49:21 +02:00
686112aa10
Type is used for the widget classname Better scaffolding of formfields Fix typo in filename
40 lines
796 B
PHP
40 lines
796 B
PHP
<?php
|
|
|
|
if(class_exists("Widget")) {
|
|
|
|
class BlogTagsWidget extends Widget {
|
|
|
|
private static $title = "Tags";
|
|
|
|
private static $cmsTitle = "Blog Tags";
|
|
|
|
private static $description = "Displays a list of blog tags.";
|
|
|
|
private static $db = array();
|
|
|
|
private static $has_one = array(
|
|
"Blog" => "Blog",
|
|
);
|
|
|
|
public function getCMSFields() {
|
|
$this->beforeUpdateCMSFields(function($fields) {
|
|
$fields->push(DropdownField::create("BlogID", _t("BlogTagsWidget.Blog", "Blog"), Blog::get()->map()));
|
|
});
|
|
return parent::getCMSFields();
|
|
}
|
|
|
|
public function getTags() {
|
|
$blog = $this->Blog();
|
|
if($blog) {
|
|
return $blog->Tags();
|
|
}
|
|
return array();
|
|
}
|
|
|
|
}
|
|
|
|
class BlogTagsWidget_Controller extends Widget_Controller {
|
|
|
|
}
|
|
|
|
} |