Provide a hook that allows other modules to alter the output of scald library items.
Use case: we needed to implement default contexts on a per atom type basis. When you drag and drop an atom from the dnd library onto a scald enabled CKEditor field, the atom will already be rendered with the system wide default context 'sdl_editor_representation'. Therefore it seemed the cleanest way to hook into the process where a scald library item gets rendered like this:
function scald_contexts_scald_dnd_library_item_alter($atom, &$item) {
// Use a default context if one has been configured for the given atom type
if ($type_context = variable_get('scald_default_context_' . $atom->type, NULL)) {
$item['editor'] = scald_render($atom, $type_context);
}
}
Comments
Comment #1
al.ex commentedComment #2
al.ex commentedComment #3
jcisio commentedThanks. Committed b929d3e.