function _webform_safe_name in Webform 7.4
Same name and namespace in other branches
- 5.2 webform.module \_webform_safe_name()
- 5 webform.module \_webform_safe_name()
- 6.3 webform.module \_webform_safe_name()
- 6.2 webform.module \_webform_safe_name()
- 7.3 webform.module \_webform_safe_name()
Convert a name into an identifier.
The identifier is safe for machine names, classes, and other ASCII uses.
3 calls to _webform_safe_name()
- webform_component_edit_form in includes/
webform.components.inc - Form to configure a webform component.
- webform_expand_select_ids in components/
select.inc - FAPI process function to rename IDs attached to checkboxes and radios.
- webform_results_download in includes/
webform.report.inc - Send a generated webform results file to the user's browser.
File
- ./
webform.module, line 4533 - This module provides a simple way to create forms and questionnaires.
Code
function _webform_safe_name($name) {
$new = trim($name);
$new = _webform_transliterate($new);
$new = str_replace(array(
' ',
'-',
'/',
), array(
'_',
'_',
'_',
), $new);
$new = drupal_strtolower($new);
$new = preg_replace('/[^a-z0-9_]/', '', $new);
return $new;
}