按类别获取RelatedPosts DataObject过滤器中的SilverStripe BlogPosts列表

时间:2017-11-09 07:37:13

标签: blogs silverstripe

我正在扩展silverstripe博客模块。 Currenly我开发了RelatedTopic DataObject。这将有一个现有的博客文章列表被选为Relatedtopic。

在我的RelatedTopic DataObject中:

    public function getCMSFields() {
    $fields = parent::getCMSFields();
    $CategoryLink = new DropdownField('BlogPostIDByCategory', 'Blog List', **Here need to pull the list of all the blogposts which are under the same category as the parent blogpost is**);

所以基本上,我希望此下拉字段中的所有博客都与此当前博客文章具有相同的类别。

请记住我正在为自己的博客文章创建Relatedtopic。在我的blogpostextension中,我将相关主题定义为

private static $many_many = array(
    'RelatedTopics' => 'RelatedTopic',
);    

public static $many_many_extraFields = array(
    'RelatedTopics' => array(
    )
);

对此的任何帮助都会受到高度关注。

0 个答案:

没有答案