You are here

function media_library_ajax_preview in Media Library 6

Upon generating a preview for an existing tag on the content, Javascript will call this from ajax with the type argument The data is on $_POST, and returns the preview content.

1 string reference to 'media_library_ajax_preview'
media_library_menu in ./media_library.module
Implementation of hook_menu()

File

./media_library.modal.inc, line 228
Modal frame functions

Code

function media_library_ajax_preview($type) {
  $object = new stdClass();

  // Get stuff from POST
  foreach ($_POST as $property => $value) {
    $object->{$property} = $value;
  }

  // Generates our preview
  drupal_alter('filter_media', $object->tag, TRUE);
  $types = media_library_get_types();
  $object->preview = module_invoke($types[$type]['module'], 'filter_media', (array) $object, TRUE);
  drupal_json($object);
}