You are here

function inline_conditions_form_ajax_callback in Inline Conditions 7

Ajax callback for the Inline Conditions form elements.

Parameters

array $form: The form array.

array &$form_state: The reference of form_state array.

Return value

array Return form element to display.

1 string reference to 'inline_conditions_form_ajax_callback'
inline_conditions_field_widget_form in ./inline_conditions.field.inc
Implements hook_field_widget_form().

File

./inline_conditions.field.inc, line 367
Field module functionality for the Inline Conditions module.

Code

function inline_conditions_form_ajax_callback($form, &$form_state) {
  $element_parents = array_slice($form_state['triggering_element']['#array_parents'], 0, -2);
  $element = drupal_array_get_nested_value($form, $element_parents);

  // Triggered when user selects a condition.
  if ($form_state['triggering_element']['#condition_action'] == 'select') {
    $delta = $form_state['triggering_element']['#element_delta'];

    // We are returning the condition settings because it's a dynamic element,
    // other elements don't need to be refreshed.
    return $element[$delta]['condition_settings'];
  }
  else {
    return $element;
  }
}