Body: <p>I'm working on a control panel plugin where I want to limit users to a subfolder within a main assets folder. I have the subfolder ID, but am unable to amend the following to make use of it:</p>
  
  <pre><code>{{ forms.elementSelect({
      id: 'register',
      name: 'fields[register]',
      elementType: craft.elements.getElementType("Asset"),
      elements: register.register | default,
      criteria: {"kind":[],"localeEnabled":null,"locale":"en_gb"},
      jsClass: 'Craft.AssetSelectInput',
      addButtonLabel: 'Upload register',
      limit: 1,
      sources: ['folder:9'],
      disabled: register.locked | default
  }) }}
  </code></pre>
  
  <p>So, for example, the folder ID above is a subfolder ID, but the asset ends up being saved within the main folder. If I revert back to the main folder ID, then everything works as expected.</p>
  
  <p>To be fair, using this subfolder ID means existing assets aren't visible, which is the main reason I'm doing this anyway. But it would still be nice if this did what I wanted to.</p>
  
  <p>Some more info:</p>
  
  <ol>
  <li>If the folder ID is a valid asset folder, it works as expected.</li>
  <li>If the folder ID is a dynamically generated subfolder of a valid asset folder, the modal doesn't show any existing files but does allow uploads (saving them directly into the parent, which actually works nicely for me).</li>
  <li>If the folder ID isn't a valid folder or subfolder, the modal is empty.</li>
  </ol>
  
  <p>Any ideas? This is kind of working from me, but more by accident.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-06-14T05:46:12.060Z
Comments.Text: There's a whitespace between ":" and "9" in "folder: 9". Is that a typo?
Comments.UserDisplayName: Andris Sevcenko
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-06-14T06:45:32.223Z
Comments.Text: Sorry, yes it is. I've updated.
Comments.UserDisplayName: Clive Portman
Tags: <plugin-development><assets><subfolder>
Title: Limit control panel assets modal to a subfolder in plugin
ThreadText: # Limit control panel assets modal to a subfolder in plugin
  
  (Asked by: username_0 on 2016-06-13)
  
  I'm working on a control panel plugin where I want to limit users to a subfolder within a main assets folder. I have the subfolder ID, but am unable to amend the following to make use of it:
  
  ```
  {{ forms.elementSelect({
      id: 'register',
      name: 'fields[register]',
      elementType: craft.elements.getElementType("Asset"),
      elements: register.register | default,
      criteria: {"kind":[],"localeEnabled":null,"locale":"en_gb"},
      jsClass: 'Craft.AssetSelectInput',
      addButtonLabel: 'Upload register',
      limit: 1,
      sources: ['folder:9'],
      disabled: register.locked | default
  }) }}
  
  ```
  
  So, for example, the folder ID above is a subfolder ID, but the asset ends up being saved within the main folder. If I revert back to the main folder ID, then everything works as expected.
  
  To be fair, using this subfolder ID means existing assets aren't visible, which is the main reason I'm doing this anyway. But it would still be nice if this did what I wanted to.
  
  Some more info:
  
  1. If the folder ID is a valid asset folder, it works as expected.
  2. If the folder ID is a dynamically generated subfolder of a valid asset folder, the modal doesn't show any existing files but does allow uploads (saving them directly into the parent, which actually works nicely for me).
  3. If the folder ID isn't a valid folder or subfolder, the modal is empty.
  
  Any ideas? This is kind of working from me, but more by accident.
  
  **Tags:** plugin-development, assets, subfolder
  
  > **Comments:**
  > **username_1**: There's a whitespace between ":" and "9" in "folder: 9". Is that a typo?  
  > **username_0**: Sorry, yes it is. I've updated.  
  
  ---
  
  ## 0 answers
  
  