function rules_ui_element_fix_empty_after_build

FAPI after build callback to ensure empty form elements result in no value.

1 string reference to 'rules_ui_element_fix_empty_after_build'
RulesDataUIText::inputForm in ui/ui.data.inc
Implements RulesDataDirectInputFormInterface::inputForm().

File

ui/ui.forms.inc, line 844

Code

function rules_ui_element_fix_empty_after_build($element, &$form_state) {
    if (isset($element['#value']) && $element['#value'] === '') {
        $element['#value'] = NULL;
        form_set_value($element, NULL, $form_state);
    }
    elseif ($element['#type'] == 'text_format' && !isset($element['value']['#value'])) {
        form_set_value($element, NULL, $form_state);
    }
    return $element;
}