Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » TreeDropdownField with only one folder

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

Page: 1
Go to End
Author Topic: 1302 Views
  • snaip
    Avatar
    Community Member
    180 Posts

    TreeDropdownField with only one folder Link to this post

    hi

    i'm using TreeDropdownField to get file from assets folders
    but it showing me all the folders in asset , i want only one

    i have
    /assets
    ..../images
    ..../pdf
    ..../flash

    i want to get only pdf folder in TreeDropdownField

    static $has_one = array(
    'PDF' => 'File'
    );
    $fields->addFieldToTab("Root.Content.Plik pdf", new TreeDropdownField('PDFID', 'Choose pdf file', 'File'));

  • MateuszU
    Avatar
    Community Member
    89 Posts

    Re: TreeDropdownField with only one folder Link to this post

    How about this:

    $tree = new TreeDropdownField('PDFID', 'Choose pdf file', 'File');
    $tree->setTreeBaseID([the id of the root folder to browse]);
    $fields->addFieldToTab("Root.Content.Plik pdf", $tree);

    m.

    1302 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.