function conditional_fields_item_in_form in Conditional Fields 6.2
Find an item in a form by key. If it's a CCK field, the function will find it using field_info.
1 call to conditional_fields_item_in_form()
- conditional_fields_node_after_build in ./
conditional_fields.module - Main tasks:
File
- ./
conditional_fields.module, line 854 - Content fields and groups visibility based on the values of user defined 'trigger' fields.
Code
function conditional_fields_item_in_form($form, $item_name, $group = FALSE) {
static $items;
if (!empty($items[$item_name])) {
return $items[$item_name];
}
if ($group) {
if (!empty($form[$group][$item_name])) {
$items[$item_name] = $form[$group][$item_name];
}
elseif (!empty($form[$group][$form['#field_info'][$item_name]['display_settings']['parent']][$item_name])) {
$items[$item_name] = $form[$group][$form['#field_info'][$item_name]['display_settings']['parent']][$item_name];
}
}
else {
if (!empty($form[$item_name])) {
$items[$item_name] = $form[$item_name];
}
elseif (!empty($form[$form['#field_info'][$item_name]['display_settings']['parent']][$item_name])) {
$items[$item_name] = $form[$form['#field_info'][$item_name]['display_settings']['parent']][$item_name];
}
}
if (!empty($items[$item_name])) {
return $items[$item_name];
}
return FALSE;
}