You are here

function upload_element_elements in Upload element 6

Implementation of hook_elements().

Defines two file form elements that are linked into the native Drupal file handling system.

The elements share four native parameters: #file_formatter - theming function to preview the element #file_validators - array of additional validation functions to perform on the uploaded file element.

The image_upload_element integrates into imagecache to enable a preset to be run against the image when saving this to the new location.

File

./upload_element.module, line 98
A module that provides two new elements to the FAPI for file handling.

Code

function upload_element_elements() {
  $type['upload_element'] = array(
    '#input' => TRUE,
    '#default_value' => '',
    '#process' => array(
      '_upload_element_expand',
    ),
    '#element_validate' => array(
      'upload_element_element_validate',
    ),
    '#file_formatter' => 'upload_element_preview',
    '#file_validators' => array(),
    '#file_validator_seperator' => '<br />',
  );
  $type['image_upload_element'] = array(
    '#input' => TRUE,
    '#default_value' => '',
    '#process' => array(
      '_upload_element_expand',
    ),
    '#element_validate' => array(
      'upload_element_element_validate',
    ),
    '#file_formatter' => 'upload_element_preview',
    '#file_validators' => array(),
    '#file_validator_seperator' => '<br />',
    '#image_formatter' => 'upload_element_image_preview',
    '#image_preview_size' => '100x100',
  );
  return $type;
}