You are here

function brightcove_field_video_client_ajax_callback in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.6 brightcove_field.video.inc \brightcove_field_video_client_ajax_callback()

AJAX callback for playlist select update on client selection and Attach button.

1 call to brightcove_field_video_client_ajax_callback()
_brightcove_field_rerender_widget in ./brightcove.module
Rerenders the brightcove field widget.
1 string reference to 'brightcove_field_video_client_ajax_callback'
_brightcove_field_video_widget_form in ./brightcove_field.video.inc
Helper function to return the video widget form.

File

./brightcove_field.video.inc, line 268
Holds all of the video field related methods.

Code

function brightcove_field_video_client_ajax_callback($form, $form_state) {
  $parents = $form_state['triggering_element']['#array_parents'];

  // This callback is used by both the client selection and the attach button
  // so we are not sure about the depth of the array. We want to get until sg
  // like ['field_video']['und'][1] and we do this by checking if the popped
  // array element is numeric or not.
  $popped = NULL;
  while (!is_numeric($popped)) {
    $popped = array_pop($parents);
  }
  $parents[] = $popped;
  $return = drupal_array_get_nested_value($form, $parents);
  unset($return['_weight']);
  return $return;
}