[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/upload_element/ -> upload_element.module (summary)

(no description)

File Size: 702 lines (25 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 24 functions

  upload_element_help()
  upload_element_menu()
  upload_element_theme()
  upload_element_init()
  upload_element_elements()
  _upload_element_expand()
  form_type_image_upload_element_value()
  form_type_upload_element_value()
  _upload_element_parse_value()
  upload_element_element_validate()
  upload_element_equals()
  theme_image_upload_element()
  theme_upload_element()
  _upload_element_action_field()
  theme_upload_element_preview()
  theme_upload_element_image_preview()
  upload_element_save()
  upload_element_imagecache_action()
  upload_element_session_handler()
  upload_element_clean_session()
  theme_upload_element_file_description()
  _upload_element_allowed_extensions()
  _upload_element_add_file_validators()
  _upload_element_delete()

Functions
Functions that are not part of a class:

upload_element_help($path, $arg)   X-Ref
Implementation of hook_help().


upload_element_menu()   X-Ref
Implementation of hook_menu().


upload_element_theme()   X-Ref
Implementation of hook_theme().


upload_element_init()   X-Ref
Implementation of hook_init().


upload_element_elements()   X-Ref
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.

_upload_element_expand($element, $edit, &$form_state, $complete_form)   X-Ref
Our #process callback to expand the control.


form_type_image_upload_element_value($form, $edit = FALSE)   X-Ref
This is the core function that handles the uploading and workflow
of the submitted files.

param: array $form The form element whose value is being populated.
param: mixed $edit The incoming POST data to populate the form element.
return: mixed The file object or empty string.

form_type_upload_element_value($form, $edit = FALSE)   X-Ref
This is the core function that handles the uploading and workflow
of the submitted files.

param: array $form The form element whose value is being populated.
param: mixed $edit The incoming POST data to populate the form element.
return: mixed The file object or empty string.

_upload_element_parse_value($element)   X-Ref
A private helper function to parse the real value from
the element. This takes into account the submit_action
when present.

param: array $element Upload element
return: mixed File object or FALSE.

upload_element_element_validate($element, &$form_state)   X-Ref
The custom validation required for files that are marked
as deleted, but are required.

param: array $element
param: array $form_state

upload_element_equals($a = FALSE, $b = FALSE)   X-Ref
Simple helper function to compare to file elements

param: mixed $a file object to compare
param: mixed $b file object to compare
return: bool

theme_image_upload_element($element)   X-Ref
Theme function to format the edit form.


theme_upload_element($element)   X-Ref
Theme function to format the edit form.


_upload_element_action_field($element)   X-Ref
Private function to generate the options that go with the
upload element

param: array $element Parent upload element
return: array $children Child elements

theme_upload_element_preview($element = NULL)   X-Ref
Simple theming function to display the uploaded file.

param: object $file File object
return: string HTML of the filename and size.

theme_upload_element_image_preview($element = NULL)   X-Ref
This creates the thumbnail preview HTML.

param: array $element
return: string HTML for image thumbnail.

upload_element_save(&$file, $dest = 0, $replace = FILE_EXISTS_RENAME, $presetname = FALSE, $delete_original = TRUE)   X-Ref
Saves an uploaded file

param: object $file File object
param: string $dest destination directory to move the file to
param: int $replace files move action
param: string $presetname Imagecache preset to perfrom on the uploaded image.
param: bool $delete_original A flag to tell the function how to handle
return: int The {files}.fid or 0

upload_element_imagecache_action($presetname, $path, $dst)   X-Ref
Hooks into imageache preset for save action

param: string $presetname Imagecache preset to perfrom on the uploaded image.
param: string $path Path to the temp original image file.
param: string $dest Path to save the new image to.
return: bool FALSE if there was a problem saving the image, TRUE otherwise.

upload_element_session_handler($op, &$form, $file = '')   X-Ref
The core storage handler for keeping the correct state
of the element in between form submissions/AHAH requests.

param: string $op Operation key.
param: array $form The upload_element element.
param: mixed $file File object or empty string
return: mixed File object or NULL depending on the $op.

upload_element_clean_session()   X-Ref
Session cleaning function.

This is used to prevent excess values getting stored
within the $_SESSION over multiple requests. It uses
the form cache to determine if the value should be
deleted or not.

theme_upload_element_file_description($element)   X-Ref
This theming function can be used to assign different text to
the description that is found under the file HTML element.

param: array $element FAPI upload element

_upload_element_allowed_extensions($element)   X-Ref
Private helper function to help pull out the allowed
extensions.

param: array $element

_upload_element_add_file_validators(&$element)   X-Ref
This is used to set the default validators

We are in a catch-22 here. If we set it in hook_elements,
the chances are that these will be overridden by any user
defined values. If we set these in the #process callback,
the options are not available to form_type_"hook"_value
or theme functions.

As such, we dynamically add these here.

_upload_element_delete($fid)   X-Ref
Private helper function for to delete files during the save process

param: $fid The fid of a file object to delete.



Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7