function theme_conditional_fields_form_item in Conditional Fields 6.2
Same name and namespace in other branches
- 5 conditional_fields.module \theme_conditional_fields_form_item()
- 6 conditional_fields.module \theme_conditional_fields_form_item()
Prepares conditional fields for rendering and handles special cases. Note that if you modify the id and classes of these fields, you have to modify conditional_fields.js accordingly.
File
- ./
conditional_fields.module, line 1445 - Content fields and groups visibility based on the values of user defined 'trigger' fields.
Code
function theme_conditional_fields_form_item($item) {
if (!empty($item['#conditional_fields_required'])) {
$item = conditional_fields_set_required_field($item);
}
if (!empty($item['#conditional_fields_theme'])) {
$rendered_item = theme($item['#conditional_fields_theme'], $item);
}
else {
$rendered_item = drupal_render($item);
}
if (empty($item['#controlling_fields']) && empty($item['#controlled_fields'])) {
return $rendered_item;
}
$id = 'conditional-' . conditional_fields_form_clean_id(!empty($item['#field_name']) ? $item['#field_name'] : $item['#array_parents'][0]);
$classes = array(
'conditional-field',
);
if (!empty($item['#controlled_fields'])) {
$classes[] = 'controlled-field';
}
if (!empty($item['#controlling_fields'])) {
$classes[] = 'controlling-field';
}
return theme('conditional_fields_wrapper', $rendered_item, $id, $classes);
}