Jump to:

5539 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » ModelAdmin Gridfield autocomplete filtering

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 438 Views
  • johannes
    Avatar
    Community Member
    20 Posts

    ModelAdmin Gridfield autocomplete filtering Link to this post

    I'm building a multi language site with the Sapphire framework and I'm trying not to bother the editors with content from others languages. Now I came across a little problem:

    What I have:
    Articles which have many tags (many_many) and the tags belong to many articles (belongs_many_many).
    Also each tag has a language property.

    My Problem:
    In the ModelAdmins Gridfield autocomplete all tags are listed, also from other languages. The canView function seems to be ignored here.

    Is there a way to show only elements matching the Members locale?

  • johannes
    Avatar
    Community Member
    20 Posts

    Re: ModelAdmin Gridfield autocomplete filtering Link to this post

    Solved it for now, but I'm not really happy because I had to edit a core file.
    I altered the doSearch function in the class GridFieldAddExisitngAutocomplete.php on line 207 :

    foreach($results as $result) {
    if ( ! $result->canView()) continue;
    $json[$result->ID] = SSViewer::fromString($this->resultsFormat)->process($result);
    }

    I hope to find another (update-safe) method to filter the results.

    438 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.