Answers.Body: <p>Something like this...</p>
  
  <pre><code>{{ forms.elementSelect({
      id: 'invoicePdf',
      name: 'fields[invoicePdf]',
      elementType: craft.elements.getElementType("Asset"),
      elements: invoice.invoicePdf | default,
      criteria: {"kind":[],"localeEnabled":null,"locale":"en_gb"},
      jsClass: 'Craft.AssetSelectInput',
      addButtonLabel: 'Upload invoice',
      limit: 1,
      sources: ['folder:1']
  }) }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-13T16:23:13.163Z
Answers.LastActivityDate: 2016-06-13T16:23:13.163Z
Answers.UserDisplayName: Clive Portman
Body: <p>So, a date field can be added to a plugin template within the control panel using:</p>
  
  <pre><code>{% from "_includes/forms" import date %}
  {{ date({
          id: 'fields-invoiceDate',
          name: 'fields[invoiceDate]'
  }) }}
  </code></pre>
  
  <p>But how do you go about adding an assets field a similar way?</p>
  
Tags: <plugin-development><assets><control-panel>
Title: How to add assets field to control panel plugin template
ThreadText: # How to add assets field to control panel plugin template
  
  (Asked by: username_0 on 2016-05-24)
  
  So, a date field can be added to a plugin template within the control panel using:
  
  ```
  {% from "_includes/forms" import date %}
  {{ date({
          id: 'fields-invoiceDate',
          name: 'fields[invoiceDate]'
  }) }}
  
  ```
  
  But how do you go about adding an assets field a similar way?
  
  **Tags:** plugin-development, assets, control-panel
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-06-13. Score: 3 | Accepted answer
  
  Something like this...
  
  ```
  {{ forms.elementSelect({
      id: 'invoicePdf',
      name: 'fields[invoicePdf]',
      elementType: craft.elements.getElementType("Asset"),
      elements: invoice.invoicePdf | default,
      criteria: {"kind":[],"localeEnabled":null,"locale":"en_gb"},
      jsClass: 'Craft.AssetSelectInput',
      addButtonLabel: 'Upload invoice',
      limit: 1,
      sources: ['folder:1']
  }) }}
  
  ```
  
  
  ---
  
  