Skip to content

[2012-12-19] Image $has_one allowing multiple when attached from files #629

Open
silverstripe-issues opened this Issue Apr 3, 2013 · 1 comment

2 participants

@silverstripe-issues

created by: @axllent (axllent)
created at: 2012-12-19
original ticket: http://open.silverstripe.org/ticket/8145


There seems to be an issue (bug?) when using the $has_one for an Image in the CMS. When a new image "'''from your computer'''" is added it allows only one (as it should), however when an image is selected "'''from files'''", a new image dialogue is created under the added image.

It seems similar to http://open.silverstripe.org/ticket/7903, however I think that issue was fixed as it seemed to relate to all added images I believe.

I've also tried adapting the code below with $upload->setConfig('allowedMaxFileNumber', 1); which made no difference either.

    static $has_one = array(
        'Image' => 'Image'
    );

    public function getCMSFields() {
        $fields = parent::getCMSFields();
        $fields->removeByName('MenuTitle');
        $fields->addFieldToTab("Root.Main", new UploadField('Image', 'Lesson Image'), 'Content');
        return $fields;
    }
@silverstripe-issues

comment by: @chillu (ischommer)
created at: 2012-12-19


Couldn't solve it, but as a starting point, you'll want to look at the _adjustMaxNumberOfFiles() method in JS, its not being called in this case.

@simonwelsh simonwelsh added the 3.1 label Mar 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.