function form_state_values_clean


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 form_state_values_clean(&$form_state)
cle7 form_state_values_clean(&$form_state)
elmsmedia7 form_state_values_clean(&$form_state)
icor7 form_state_values_clean(&$form_state)
meedjum_blog7 form_state_values_clean(&$form_state)
mooc7 form_state_values_clean(&$form_state)

Removes internal Form API elements and buttons from submitted form values.

This function can be used when a module wants to store all submitted form values, for example, by serializing them into a single database column. In such cases, all internal Form API values and all form button elements should not be contained, and this function allows to remove them before the module proceeds to storage. Next to button elements, the following internal values are removed:

  • form_id
  • form_token
  • form_build_id
  • op


$form_state: A keyed array containing the current state of the form, including submitted form values; altered by reference.

Related topics

11 calls to form_state_values_clean()
devel_image_provider_providers_form_submit in sites/all/modules/ulmus/devel_image_provider/devel_image_provider.module
Submit handler for the providers settings.
entity_view_mode_edit_form_submit in sites/all/modules/local_contrib/entity_view_mode/
filter_admin_format_form_submit in modules/filter/
Form submission handler for filter_admin_format_form().
form_test_form_state_values_clean_advanced_form_submit in modules/simpletest/tests/form_test.module
Form submission handler for form_test_form_state_values_clean_advanced_form().
form_test_form_state_values_clean_form_submit in modules/simpletest/tests/form_test.module
Form submit handler for form_state_values_clean() test form.

... See full list


includes/, line 2195
Functions for form and batch generation and processing.


function form_state_values_clean(&$form_state) {
  // Remove internal Form API values.
  unset($form_state['values']['form_id'], $form_state['values']['form_token'], $form_state['values']['form_build_id'], $form_state['values']['op']);

  // Remove button values.
  // form_builder() collects all button elements in a form. We remove the button
  // value separately for each button element.
  foreach ($form_state['buttons'] as $button) {
    // Remove this button's value from the submitted form values by finding
    // the value corresponding to this button.
    // We iterate over the #parents of this button and move a reference to
    // each parent in $form_state['values']. For example, if #parents is:
    //   array('foo', 'bar', 'baz')
    // then the corresponding $form_state['values'] part will look like this:
    // array(
    //   'foo' => array(
    //     'bar' => array(
    //       'baz' => 'button_value',
    //     ),
    //   ),
    // )
    // We start by (re)moving 'baz' to $last_parent, so we are able unset it
    // at the end of the iteration. Initially, $values will contain a
    // reference to $form_state['values'], but in the iteration we move the
    // reference to $form_state['values']['foo'], and finally to
    // $form_state['values']['foo']['bar'], which is the level where we can
    // unset 'baz' (that is stored in $last_parent).
    $parents = $button['#parents'];
    $last_parent = array_pop($parents);
    $key_exists = NULL;
    $values = &drupal_array_get_nested_value($form_state['values'], $parents, $key_exists);
    if ($key_exists && is_array($values)) {



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.