function ajax_browse_video_dialog_callback in Brightcove Video Connect 7.7
Same name and namespace in other branches
- 7.3 brightcove_field/brightcove_field.module \ajax_browse_video_dialog_callback()
- 7.4 brightcove_field/brightcove_field.module \ajax_browse_video_dialog_callback()
- 7.5 brightcove_field/brightcove_field.module \ajax_browse_video_dialog_callback()
- 7.6 brightcove.module \ajax_browse_video_dialog_callback()
1 string reference to 'ajax_browse_video_dialog_callback'
- _brightcove_field_video_widget_form in ./
brightcove_field.video.inc - Helper function to return the video widget form.
File
- ./
brightcove.module, line 1084 - Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.
Code
function ajax_browse_video_dialog_callback($form, $form_state) {
$field_rel = $form_state['triggering_element']['#attributes']['rel'];
$field_name = $form_state['triggering_element']['#parents'][0];
$entity = $form['#entity'];
$entity_type = $form['#entity_type'];
$bundle = $form['#bundle'];
$eid_extracted = entity_extract_ids($entity_type, $entity);
$eid = array_shift($eid_extracted);
$entity_id_or_bundle = !empty($eid) ? $eid : $bundle;
$bcid = $form_state['triggering_element']['#attributes']['data-client-id'];
$client = brightcove_client_load($bcid);
$form_state['rebuild'] = TRUE;
$title = t('Brightcove Video Browser for client @client', [
'@client' => $client->label,
]);
$id = 'browse-dialog';
$selector = '<div id="' . $id . '">';
$path = url("brightcove_field/browse_video/{$entity_type}/{$field_name}/{$entity_id_or_bundle}/{$bcid}");
$commands = [];
$commands[] = ajax_command_dialog($title, $id, $selector, $path, $field_rel, NULL, TRUE);
_brightcove_field_rerender_widget($commands, $form, $form_state);
return [
'#type' => 'ajax',
'#commands' => $commands,
];
}