function google_tag_text_clean in GoogleTagManager 7
Same name and namespace in other branches
- 7.2 includes/form/container.inc \google_tag_text_clean()
- 7.2 includes/form/settings.inc \google_tag_text_clean()
Cleans a string representing a list of items.
Parameters
string $text: The string to clean.
string $format: The final format of $text, either 'string' or 'array'.
4 calls to google_tag_text_clean()
- google_tag_settings_form_validate in includes/
admin.inc - Form validation handler for google_tag_settings_form().
- _google_tag_data_layer_snippet in includes/
snippet.inc - Returns JavaScript data layer snippet or adds items to data layer.
- _google_tag_validate_listed_classes in includes/
variable.inc - Element validation handler for google_tag_listed_classes.
- _google_tag_validate_text in includes/
variable.inc - Element validation handler for text values.
File
- includes/
admin.inc, line 379 - Contains the administrative page and form callbacks.
Code
function google_tag_text_clean(&$text, $format = 'string') {
$text = explode("\n", $text);
$text = array_map('trim', $text);
$text = array_filter($text, 'trim');
if ($format == 'string') {
$text = implode("\n", $text);
}
}