[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/includes/ -> form.inc (summary)

(no description)

File Size: 2565 lines (95 kb)
Included or required: 5 times
Referenced: 0 times
Includes or requires: 1 file
 includes/batch.inc

Defines 70 functions

  drupal_get_form()
  drupal_rebuild_form()
  form_set_cache()
  form_get_cache()
  drupal_execute()
  drupal_retrieve_form()
  drupal_process_form()
  drupal_prepare_form()
  drupal_validate_form()
  drupal_render_form()
  drupal_redirect_form()
  _form_validate()
  form_execute_handlers()
  form_set_error()
  form_get_errors()
  form_get_error()
  form_error()
  form_builder()
  _form_builder_handle_input_element()
  _form_button_was_clicked()
  _form_builder_ie_cleanup()
  form_type_image_button_value()
  form_type_checkbox_value()
  form_type_checkboxes_value()
  form_type_password_confirm_value()
  form_type_select_value()
  form_type_textfield_value()
  form_type_token_value()
  form_set_value()
  _form_set_value()
  _element_info()
  form_options_flatten()
  theme_select()
  form_select_options()
  form_get_options()
  theme_fieldset()
  theme_radio()
  theme_radios()
  theme_password_confirm()
  expand_password_confirm()
  password_confirm_validate()
  theme_date()
  expand_date()
  date_validate()
  map_month()
  weight_value()
  expand_radios()
  form_expand_ahah()
  theme_item()
  theme_checkbox()
  theme_checkboxes()
  expand_checkboxes()
  theme_submit()
  theme_button()
  theme_image_button()
  theme_hidden()
  theme_token()
  theme_textfield()
  theme_form()
  theme_textarea()
  theme_markup()
  theme_password()
  process_weight()
  theme_file()
  theme_form_element()
  _form_set_class()
  form_clean_id()
  batch_set()
  batch_process()
  batch_get()

Functions
Functions that are not part of a class:

drupal_get_form($form_id)   X-Ref
Retrieves a form from a constructor function, or from the cache if
the form was built in a previous page-load. The form is then passed
on for processing, after and rendered for display if necessary.

param: $form_id
param: ...
return:

drupal_rebuild_form($form_id, &$form_state, $args, $form_build_id = NULL)   X-Ref
Retrieves a form, caches it and processes it with an empty $_POST.

This function clears $_POST and passes the empty $_POST to the form_builder.
To preserve some parts from $_POST, pass them in $form_state.

If your AHAH callback simulates the pressing of a button, then your AHAH
callback will need to do the same as what drupal_get_form would do when the
button is pressed: get the form from the cache, run drupal_process_form over
it and then if it needs rebuild, run drupal_rebuild_form over it. Then send
back a part of the returned form.
$form_state['clicked_button']['#array_parents'] will help you to find which
part.

param: $form_id
param: $form_state
param: $args
param: $form_build_id
return:

form_set_cache($form_build_id, $form, $form_state)   X-Ref
Store a form in the cache.


form_get_cache($form_build_id, &$form_state)   X-Ref
Fetch a form from cache.


drupal_execute($form_id, &$form_state)   X-Ref
Retrieves, populates, and processes a form.

This function allows you to supply values for form elements and submit a
form for processing. Compare to drupal_get_form(), which also builds and
processes a form, but does not allow you to supply values.

There is no return value, but you can check to see if there are errors by
calling form_get_errors().

param: $form_id
param: $form_state
param: ...

drupal_retrieve_form($form_id, &$form_state)   X-Ref
Retrieves the structured array that defines a given form.

param: $form_id
param: $form_state
param: ...

drupal_process_form($form_id, &$form, &$form_state)   X-Ref
This function is the heart of form API. The form gets built, validated and in
appropriate cases, submitted.

param: $form_id
param: $form
param: $form_state

drupal_prepare_form($form_id, &$form, &$form_state)   X-Ref
Prepares a structured form array by adding required elements,
executing any hook_form_alter functions, and optionally inserting
a validation token to prevent tampering.

param: $form_id
param: $form
param: $form_state

drupal_validate_form($form_id, $form, &$form_state)   X-Ref
Validates user-submitted form data from the $form_state using
the validate functions defined in a structured form array.

param: $form_id
param: $form
param: $form_state

drupal_render_form($form_id, &$form)   X-Ref
Renders a structured form array into themed HTML.

param: $form_id
param: $form
return:

drupal_redirect_form($form, $redirect = NULL)   X-Ref
Redirect the user to a URL after a form has been processed.

param: $form
param: $redirect

_form_validate($elements, &$form_state, $form_id = NULL)   X-Ref
Performs validation on form elements. First ensures required fields are
completed, #maxlength is not exceeded, and selected options were in the
list of options given to the user. Then calls user-defined validators.

param: $elements
param: $form_state
param: $form_id

form_execute_handlers($type, &$form, &$form_state)   X-Ref
A helper function used to execute custom validation and submission
handlers for a given form. Button-specific handlers are checked
first. If none exist, the function falls back to form-level handlers.

param: $type
param: $form
param: $form_state

form_set_error($name = NULL, $message = '', $reset = FALSE)   X-Ref
File an error against a form element.

param: $name
param: $message
param: $reset
return:

form_get_errors()   X-Ref
Return an associative array of all errors.


form_get_error($element)   X-Ref
Return the error message filed against the form with the specified name.


form_error(&$element, $message = '')   X-Ref
Flag an element as having an error.


form_builder($form_id, $form, &$form_state)   X-Ref
Walk through the structured form array, adding any required
properties to each element and mapping the incoming $_POST
data to the proper elements.

param: $form_id
param: $form
param: $form_state

_form_builder_handle_input_element($form_id, &$form, &$form_state, $complete_form)   X-Ref
Populate the #value and #name properties of input elements so they
can be processed and rendered. Also, execute any #process handlers
attached to a specific element.


_form_button_was_clicked($form)   X-Ref
Helper function to handle the sometimes-convoluted logic of button
click detection.

In Internet Explorer, if ONLY one submit button is present, AND the
enter key is used to submit the form, no form value is sent for it
and we'll never detect a match. That special case is handled by
_form_builder_ie_cleanup().

_form_builder_ie_cleanup($form, &$form_state)   X-Ref
In IE, if only one submit button is present, AND the enter key is
used to submit the form, no form value is sent for it and our normal
button detection code will never detect a match. We call this
function after all other button-detection is complete to check
for the proper conditions, and treat the single button on the form
as 'clicked' if they are met.


form_type_image_button_value($form, $edit = FALSE)   X-Ref
Helper function to determine the value for an image button form element.

param: $form
param: $edit
return:

form_type_checkbox_value($form, $edit = FALSE)   X-Ref
Helper function to determine the value for a checkbox form element.

param: $form
param: $edit
return:

form_type_checkboxes_value($form, $edit = FALSE)   X-Ref
Helper function to determine the value for a checkboxes form element.

param: $form
param: $edit
return:

form_type_password_confirm_value($form, $edit = FALSE)   X-Ref
Helper function to determine the value for a password_confirm form
element.

param: $form
param: $edit
return:

form_type_select_value($form, $edit = FALSE)   X-Ref
Helper function to determine the value for a select form element.

param: $form
param: $edit
return:

form_type_textfield_value($form, $edit = FALSE)   X-Ref
Helper function to determine the value for a textfield form element.

param: $form
param: $edit
return:

form_type_token_value($form, $edit = FALSE)   X-Ref
Helper function to determine the value for form's token value.

param: $form
param: $edit
return:

form_set_value($form_item, $value, &$form_state)   X-Ref
Change submitted form values during the form processing cycle.

Use this function to change the submitted value of a form item in the
validation phase so that it persists in $form_state through to the
submission handlers in the submission phase.

Since $form_state['values'] can either be a flat array of values, or a tree
of nested values, some care must be taken when using this function.
Specifically, $form_item['#parents'] is an array that describes the branch of
the tree whose value should be updated. For example, if we wanted to update
$form_state['values']['one']['two'] to 'new value', we'd pass in
$form_item['#parents'] = array('one', 'two') and $value = 'new value'.

param: $form_item
param: $value
param: $form_state

_form_set_value(&$form_values, $form_item, $parents, $value)   X-Ref
Helper function for form_set_value().

We iterate over $parents and create nested arrays for them
in $form_state['values'] if needed. Then we insert the value into
the right array.

_element_info($type, $refresh = NULL)   X-Ref
Retrieve the default properties for the defined element type.


form_options_flatten($array, $reset = TRUE)   X-Ref
No description

theme_select($element)   X-Ref
Format a dropdown menu or scrolling selection box.

param: $element
return:

form_select_options($element, $choices = NULL)   X-Ref
No description

form_get_options($element, $key)   X-Ref
Traverses a select element's #option array looking for any values
that hold the given key. Returns an array of indexes that match.

This function is useful if you need to modify the options that are
already in a form element; for example, to remove choices which are
not valid because of additional filters imposed by another module.
One example might be altering the choices in a taxonomy selector.
To correctly handle the case of a multiple hierarchy taxonomy,
#options arrays can now hold an array of objects, instead of a
direct mapping of keys to labels, so that multiple choices in the
selector can have the same key (and label). This makes it difficult
to manipulate directly, which is why this helper function exists.

This function does not support optgroups (when the elements of the
#options array are themselves arrays), and will return FALSE if
arrays are found. The caller must either flatten/restore or
manually do their manipulations in this case, since returning the
index is not sufficient, and supporting this would make the
"helper" too complicated and cumbersome to be of any help.

As usual with functions that can return array() or FALSE, do not
forget to use === and !== if needed.

param: $element
param: $key
return:

theme_fieldset($element)   X-Ref
Format a group of form items.

param: $element
return:

theme_radio($element)   X-Ref
Format a radio button.

param: $element
return:

theme_radios($element)   X-Ref
Format a set of radio buttons.

param: $element
return:

theme_password_confirm($element)   X-Ref
Format a password_confirm item.

param: $element
return:

expand_password_confirm($element)   X-Ref
Expand a password_confirm field into two text boxes.


password_confirm_validate($form, &$form_state)   X-Ref
Validate password_confirm element.


theme_date($element)   X-Ref
Format a date selection element.

param: $element
return:

expand_date($element)   X-Ref
Roll out a single date element.


date_validate($form)   X-Ref
Validates the date type to stop dates like February 30, 2006.


map_month($month)   X-Ref
Helper function for usage with drupal_map_assoc to display month names.


weight_value(&$form)   X-Ref
If no default value is set for weight select boxes, use 0.


expand_radios($element)   X-Ref
Roll out a single radios element to a list of radios,
using the options array as index.


form_expand_ahah($element)   X-Ref
Add AHAH information about a form element to the page to communicate with
javascript. If #ahah[path] is set on an element, this additional javascript is
added to the page header to attach the AHAH behaviors. See ahah.js for more
information.

param: $element
return:

theme_item($element)   X-Ref
Format a form item.

param: $element
return:

theme_checkbox($element)   X-Ref
Format a checkbox.

param: $element
return:

theme_checkboxes($element)   X-Ref
Format a set of checkboxes.

param: $element
return:

expand_checkboxes($element)   X-Ref
No description

theme_submit($element)   X-Ref
Theme a form submit button.


theme_button($element)   X-Ref
Theme a form button.


theme_image_button($element)   X-Ref
Theme a form image button.


theme_hidden($element)   X-Ref
Format a hidden form field.

param: $element
return:

theme_token($element)   X-Ref
Format a form token.


theme_textfield($element)   X-Ref
Format a textfield.

param: $element
return:

theme_form($element)   X-Ref
Format a form.

param: $element
return:

theme_textarea($element)   X-Ref
Format a textarea.

param: $element
return:

theme_markup($element)   X-Ref
Format HTML markup for use in forms.

This is used in more advanced forms, such as theme selection and filter format.

param: $element
return:

theme_password($element)   X-Ref
Format a password field.

param: $element
return:

process_weight($element)   X-Ref
Expand weight elements into selects.


theme_file($element)   X-Ref
Format a file upload field.

param: $title
param: $name
param: $size
param: $description
param: $required
return:

theme_form_element($element, $value)   X-Ref
Return a themed form element.

param: element
param: $value
return:

_form_set_class(&$element, $class = array()   X-Ref
Sets a form element's class attribute.

Adds 'required' and 'error' classes as needed.

param: &$element
param: $name

form_clean_id($id = NULL, $flush = FALSE)   X-Ref
Prepare an HTML ID attribute string for a form item.

Remove invalid characters and guarantee uniqueness.

param: $id
param: $flush
return:

batch_set($batch_definition)   X-Ref
Opens a new batch.

param: $batch

batch_process($redirect = NULL, $url = NULL)   X-Ref
Processes the batch.

Unless the batch has been marked with 'progressive' = FALSE, the function
issues a drupal_goto and thus ends page execution.

This function is not needed in form submit handlers; Form API takes care
of batches that were set during form submission.

param: $redirect
param: $url

batch_get()   X-Ref
Retrieves the current batch.




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