function media_library_modal_finish in Media Library 6
1 string reference to 'media_library_modal_finish'
- media_library_modal_add in ./
media_library.modal.inc - Second step in the modal dialog, for generating the multi-step form.
File
- ./
media_library.modal.inc, line 166 - Modal frame functions
Code
function media_library_modal_finish(&$form_state) {
// Generates the tag to be saved
$tag = media_library_create_filter_tag($form_state['media_obj']);
// Handles common textarea inserts
if (isset($form_state['media_obj']->textarea)) {
$form_state['commands'][] = array(
'command' => 'ml_insert',
'selector' => '#' . $textarea,
'data' => $tag,
);
}
elseif ($form_state['media_obj']->tiny) {
// Generates the preview
drupal_alter('filter_media', $form_state['media_obj']->tag, TRUE);
$types = media_library_get_types();
$form_state['media_obj']->preview = module_invoke($types[$form_state['media_obj']->type]['module'], 'filter_media', (array) $form_state['media_obj'], TRUE);
// Save the tag
$form_state['media_obj']->tag = $tag;
// Check for insert vs update
if (isset($form_state['action']) && $form_state['action'] == 'update') {
$command = 'ml_update_tiny';
}
else {
$command = 'ml_insert_tiny';
}
$form_state['commands'][] = array(
'command' => $command,
'data' => $form_state['media_obj'],
);
}
media_library_clear_cache('media_obj');
}