You are here

function media_library_modal in Media Library 6

Main modal frame

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

File

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

Code

function media_library_modal() {
  ctools_include('modal');
  ctools_include('ajax');
  ctools_include('object-cache');
  $object = media_library_get_cache('media_obj');
  if (!is_object($object)) {
    $object = new stdClass();
  }

  // Textarea name
  $textarea = $_GET['textarea'];
  if (!empty($textarea)) {
    $object->textarea = $textarea;
  }
  foreach ($_POST as $attr => $value) {
    $object->{$attr} = $value;
  }
  ctools_object_cache_set('media_library', 'media_obj', $object);
  if (empty($object->type)) {
    ctools_modal_render(t('Choose a media content to add'), media_library_types_choice());
  }
  else {

    // If we are editing an existing object, lets jump to it
    media_library_modal_add($object->type);
  }
  ctools_modal_render(t('Error'), t('Error processing request'));
}