You are here

function scald_dnd_library_add_item in Scald: Media Management made easy 6

Same name and namespace in other branches
  1. 7 modules/library/scald_dnd_library/scald_dnd_library.module \scald_dnd_library_add_item()

Adds an item in the library array.

1 call to scald_dnd_library_add_item()
scald_plugin_display_library::execute in scald_dnd_library/includes/scald_plugin_display_library.inc
The library won't go through the normal theming / page rendering process. Instead, we'll just fetch / render the atoms, and print the JSON by itself. We won't be returning anything, which tells Drupal that everything is already rendered.

File

scald_dnd_library/scald_dnd_library.module, line 44
Scald DnD Library

Code

function scald_dnd_library_add_item(&$library, $sid) {
  $atom = scald_fetch($sid);
  $library['atoms'][$sid] = array(
    'meta' => array(
      'title' => $atom->title,
      'type' => $atom->type,
      'legend' => theme('sdl_editor_legend', $atom),
      'action' => $atom->base_entity->license->action_fin,
    ),
    'editor' => scald_render($atom, 'sdl_editor_representation'),
    'preview' => scald_render($atom, 'sdl_preview'),
    'library' => scald_render($atom, 'sdl_library_item'),
  );
}