function _webform_update_8136 in Webform 8.5
Same name and namespace in other branches
- 6.x includes/webform.install.update.inc \_webform_update_8136()
Update #counter_* attributes.
Replace 'X' in counter message with '%d' and move '#counter_message' to '#counter_maximum_message'.
Parameters
array $element: A form element.
1 call to _webform_update_8136()
- webform_update_8136 in includes/
webform.install.update.inc - Issue #2987174: Replace and improve word/character counter.
File
- includes/
webform.install.update.inc, line 2497 - Archived Webform update hooks.
Code
function _webform_update_8136(array &$element) {
if (isset($element['#counter_message'])) {
if (strpos($element['#counter_message'], 'X') === FALSE) {
$element['#counter_message'] = '%d ' . $element['#counter_message'];
}
else {
$element['#counter_message'] = str_replace('X', '%d', $element['#counter_message']);
}
$element['#counter_maximum_message'] = $element['#counter_message'];
unset($element['#counter_message']);
}
foreach (Element::children($element) as $key) {
if (is_array($element[$key])) {
_webform_update_8136($element[$key]);
}
}
}