function _brightcove_field_rerender_widget in Brightcove Video Connect 7.6
Same name and namespace in other branches
- 7.7 brightcove.module \_brightcove_field_rerender_widget()
Rerenders the brightcove field widget.
This is necessary, because for some reason the AJAX buttons work only once if they are loaded by AJAX and not rendered on the page originally.
Parameters
array $commands: AJAX commands array.
array $form: Parent form.
array $form_state: Parent form state.
2 calls to _brightcove_field_rerender_widget()
File
- ./
brightcove.module, line 1045 - 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 _brightcove_field_rerender_widget(array &$commands, array $form, array $form_state) {
$field_name = $form_state['triggering_element']['#parents'][0];
$delta = $form_state['triggering_element']['#parents'][2];
$wrapper = _brightcove_field_get_wrapper_name($field_name, $delta);
module_load_include('inc', 'brightcove', 'brightcove_field.video');
$content = brightcove_field_video_client_ajax_callback($form, $form_state);
$rendered_content = drupal_render($content);
$commands[] = ajax_command_replace("#{$wrapper}", $rendered_content);
}