You are here

function dragndrop_upload_example_element in Drag & Drop Upload 7

Form callback for the 'dragndrop-upload/example-element'.

1 string reference to 'dragndrop_upload_example_element'
dragndrop_upload_example_menu in modules/dragndrop_upload_example/dragndrop_upload_example.module
Implements hook_menu().

File

modules/dragndrop_upload_example/dragndrop_upload_example.module, line 106
Contains examples of how to create droppable zones.

Code

function dragndrop_upload_example_element($form, &$form_state) {
  $form = array();
  $path = drupal_get_path('module', 'dragndrop_upload_example');
  $form['dnd'] = array(
    '#type' => 'dragndrop_upload',
    '#title' => t('Drag & Drop files here'),
    '#file_upload_max_size' => '10M',
    '#upload_location' => 'public://',
    '#upload_event' => 'manual',
  );
  $form['dropzone'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array(
        'dragndrop-example-element-mirror',
      ),
    ),
    'text' => array(
      '#markup' => t('Mirror dropzone here'),
    ),
    '#attached' => array(
      'css' => array(
        $path . '/css/dragndrop-upload-example.css',
      ),
    ),
  );

  // It is needed to prefix element name that needs a mirror with "droppable-"
  // to get its identifier.
  dragndrop_upload_dropzone_add('.dragndrop-example-element-mirror', array(
    'asMirrorFor' => '#droppable-dnd',
  ));
  return $form;
}