function editablefields_form_alter in Editable Fields 5.3
Same name and namespace in other branches
- 5 editablefields.module \editablefields_form_alter()
- 5.2 editablefields.module \editablefields_form_alter()
- 6.3 editablefields.module \editablefields_form_alter()
File
- ./
editablefields.module, line 609
Code
function editablefields_form_alter($form_id, &$form) {
foreach ($form as $key => $f) {
if (preg_match('/^editablefieldsfiltervalue_(.*)$/', $key, $matches)) {
$fieldname = $matches[1];
foreach ($form[$fieldname] as $element => $val) {
if (is_array($val) && is_array($val['#default_value'])) {
$form[$fieldname][$element]['#default_value'] = $f['#value'];
if (!$form[$fieldname][$element]['#options'][$f['#value'][0]]) {
$form[$fieldname][$element]['#options'][$f['#value'][0]] = t('-- this --');
}
}
}
}
}
}