'Blog', ); /** * {@inheritdoc} */ public function getCMSFields() { $this->beforeUpdateCMSFields(function ($fields) { $fields->push( DropdownField::create('BlogID', _t('BlogCategoriesWidget.Blog', 'Blog'), Blog::get()->map()) ); }); return parent::getCMSFields(); } /** * @return array */ public function getCategories() { $blog = $this->Blog(); if($blog) { return $blog->Categories(); } return array(); } } class BlogCategoriesWidget_Controller extends Widget_Controller { }