You are here

function ajax_upload_dialog_callback in Brightcove Video Connect 7.2

1 string reference to 'ajax_upload_dialog_callback'
brightcove_field_field_widget_form in brightcove_field/brightcove_field.module
Implements hook_field_widget_form().

File

brightcove_field/brightcove_field.module, line 1456
Brightcove field module provides a Content Construction Kit module to developers, allowing them to browse videos in their Brightcove Studio and upload them.

Code

function ajax_upload_dialog_callback($form, $form_state) {
  $et = $form_state['triggering_element']['#attributes']['data-entity-type'];
  $bundle = $form_state['triggering_element']['#attributes']['data-bundle'];
  $fn = $form_state['triggering_element']['#attributes']['data-field-name'];
  $eid = $form_state['triggering_element']['#attributes']['data-entity-id'];
  $field_rel = $form_state['triggering_element']['#attributes']['rel'];
  $title = 'Upload Video to Brightcove';
  $id = 'upload-dialog';
  $selector = '<div id="' . $id . '">';
  $path = url("brightcove_field/upload/{$et}/{$fn}/" . ($eid ? $eid : ($bundle ? $bundle : 0)));
  $commands = array();
  $commands[] = ajax_command_dialog($title, $id, $selector, $path, $field_rel, NULL, TRUE);
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}