Source of file BlogCategoriesWIdget.php
Size: 0,862 Bytes - Last Modified: 2021-12-23T10:04:17+00:00
/var/www/docs.ssmods.com/process/src/code/widgets/BlogCategoriesWIdget.php
12345678910111213141516171819202122232425262728293031323334353637383940414243 | <?php if(class_exists("Widget")) { 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 = FieldList::create(); $fields->push( DropdownField::create("BlogID", _t("BlogCategoriesWidget.Blog", "Blog"), Blog::get()->map()) ); $this->extend("updateCMSFields", $fields); return $fields; } public function getCategories() { $blog = $this->Blog(); if($blog) { return $blog->Categories(); } return array(); } } class BlogCategoriesWidget_Controller extends Widget_Controller { } } |