form_clean_id

  1. drupal
    1. 4.7
    2. 5
    3. 6 form.inc
Versions
4.7 – 5 form_clean_id($id = NULL)
6 form_clean_id($id = NULL, $flush = FALSE)

Remove invalid characters from an HTML ID attribute string.

Parameters

$id The ID to clean.

Return value

The cleaned ID.

Related topics

▾ 3 functions call form_clean_id()

drupal_prepare_form in includes/form.inc
Prepares a structured form array by adding required elements, executing any hook_form_alter functions, and optionally inserting a validation token to prevent tampering.
expand_radios in includes/form.inc
Roll out a single radios element to a list of radios, using the options array as index.
form_builder in includes/form.inc
Adds some required properties to each form element, which are used internally in the form API. This function also automatically assigns the value property from the $edit array, provided the element doesn't already have an assigned value.

Code

includes/form.inc, line 1612

<?php
function form_clean_id($id = NULL) {
  $id = str_replace(array('][', '_', ' '), '-', $id);
  return $id;
}
?>