function _conflict_apply_error in Conflict 7
Iterate all elements children recursively and set error class.
Parameters
array $elements:
1 call to _conflict_apply_error()
- conflict_form_node_form_alter in ./
conflict.module - Implements hook_form_FORM_ID_alter().
File
- ./
conflict.module, line 155 - Fieldwise conflict prevention and resolution. @author Brandon Bergren
Code
function _conflict_apply_error(&$elements) {
// Iterate through all children.
foreach (element_children($elements) as $key) {
if (isset($elements[$key]) && $elements[$key]) {
_conflict_apply_error($elements[$key]);
}
}
// If there are properties, it's probably safe to set #attributes here.
// Ignore container elements, because 'error' class adds a weird style there.
$element_properties = element_properties($elements);
if (!empty($element_properties) && (isset($elements['#type']) && $elements['#type'] != 'container')) {
$elements['#attributes']['class'][] = 'error';
}
}