Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » setAllowedExtensions and setFolderName

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

Page: 1
Go to End
Author Topic: 1885 Views
  • malinux
    Avatar
    Community Member
    23 Posts

    setAllowedExtensions and setFolderName Link to this post

    Hi

    I'm making a module and I'm trying to do the following:

    ----------------
    function getCMSFields_forPopup() {
    $CardImageField = new ImageField( 'CardImage' );
    $CardImageField->setAllowedExtensions(array( 'png' ));
    $CardImageField->setFolderName( 'flashcards' );

    $fields = new FieldSet();
    $fields->push( new TextField( 'CardName' ) );
    //$fields->push( new ImageField( 'CardImage' ) );
    $fields->push( $CardImageField );
    $fields->push( new TextField( 'CardContent' ) );
    return $fields;
    }
    ----------------

    I could see in an earlier thread that setAllowedExtensions() and setFolderName() does not work on ImageField. Is there any other way to do this?

    Are there any plans about fixing it?

  • PeterB
    Avatar
    Community Member
    18 Posts

    Re: setAllowedExtensions and setFolderName Link to this post

    To have a method documented in the API but not working is bad form - and not having any replies to this post either.

    So, is it going to be fixed?

  • Willr
    Avatar
    Forum Moderator
    5511 Posts

    Re: setAllowedExtensions and setFolderName Link to this post

    PeterB - I recommend posting this issue and a test case of what is broken on open.silverstripe.org (or there may even be an existing ticket - which in that case, do nothing).

    Make sure you include the version of SilverStripe you are using and if you are not using trunk then you might want to download that and attempt it and see if it has been fixed in trunk.

  • ajshort
    Avatar
    Community Member
    244 Posts

    Re: setAllowedExtensions and setFolderName Link to this post

    I fixed these issues a while ago in trunk with a FileIFrameField & ImageField refactoring - however, these fixes are not available in the 2.3 branch.

  • PeterB
    Avatar
    Community Member
    18 Posts

    Re: setAllowedExtensions and setFolderName Link to this post

    How stable is trunk and is it ready for production use? Compatibility of modules would be a concern as my site's making heavy use of them.

    Can I suggest that documentation (both normal and API docs) is versioned? That way it becomes clear what's usable in trunk and what's usable in the 'stable' 2.3 release. The Kohana team had this issue, and they've adopted a similar approach to Symfony & Doctrine with their documentation.

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