You are here

function conditional_fields_item_apply_theme in Conditional Fields 6.2

Insert appropriate themeing functions in a conditional field form element.

1 call to conditional_fields_item_apply_theme()
conditional_fields_node_after_build in ./conditional_fields.module
Main tasks:

File

./conditional_fields.module, line 834
Content fields and groups visibility based on the values of user defined 'trigger' fields.

Code

function conditional_fields_item_apply_theme(&$element, $group_name = '') {
  if (!empty($group_name)) {
    $element['#group_id'] = 'conditional-' . conditional_fields_form_clean_id($group_name);

    // We add themeing in post_render so the wrapping is outside the fieldset.
    $post_render = isset($element['#post_render']) && is_array($element['#post_render']) ? $element['#post_render'] : array();
    $element['#post_render'] = array_merge(array(
      'conditional_fields_fieldgroup_post_render',
    ), $post_render);
  }
  else {

    // Save a previously set function so it can be called before rendering the field
    if (!empty($element['#theme']) && $element['#theme'] != 'conditional_fields_form_item') {
      $element['#conditional_fields_theme'] = $element['#theme'];
    }
    $element['#theme'] = 'conditional_fields_form_item';
  }
}