You are here

function dragndrop_upload_example_dropzone in Drag & Drop Upload 7

Page callback for 'dragndrop-upload/example-api'.

1 string reference to 'dragndrop_upload_example_dropzone'
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 33
Contains examples of how to create droppable zones.

Code

function dragndrop_upload_example_dropzone() {
  if ($_FILES) {
    exit(print_r($_FILES, 1));
  }
  $build = array();
  $settings = array(
    'selector' => '.dragndrop-example-api',
    'settings' => array(
      'name' => 'dragndrop-example-api',
      'callback' => 'dragndrop_upload_example_dropzone_callback',
    ),
  );
  $path = drupal_get_path('module', 'dragndrop_upload_example');
  $build['dropzone'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => 'dragndrop-example-api',
    ),
    'text' => array(
      '#markup' => t('Dropzone here'),
    ),
    '#attached' => array(
      'css' => array(
        $path . '/css/dragndrop-upload-example.css',
      ),
      'dragndrop_upload' => array(
        $settings,
      ),
    ),
  );
  $build['dropzone2'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => 'dragndrop-example-api',
    ),
    'text' => array(
      '#markup' => t('Same dropzone here'),
    ),
    '#attached' => array(
      'dragndrop_upload' => array(
        $settings,
      ),
    ),
  );
  return $build;
}