function scald_atom_view in Scald: Media Management made easy 7
Handles the view of an atom within a context.
Contrary to scald_render(), which displays basically a "player", this function displays the player and all atom fields. Fields are reorderable and customisable in the Field UI as usual.
Parameters
ScaldAtom $atom: Atom to be rendered
string $context: (optional) Name of the context (view mode). Defaults to 'full'.
string $langcode: (optional) A langcode to use for rendering.
Return value
array An array as expected by drupal_render().
1 call to scald_atom_view()
- scald_scald_render in ./
scald.module - Implements hook_scald_render().
File
- includes/
scald.atom.inc, line 24 - Functions related to the Scald atom entity rendering.
Code
function scald_atom_view($atom, $context = 'full', $langcode = NULL) {
if (!isset($langcode)) {
$langcode = $GLOBALS['language_content']->language;
}
// Populate $atom->content with a render() array.
scald_atom_build_content($atom, $context, $langcode);
$build = $atom->content;
// We don't need duplicate rendering info in atom->content.
unset($atom->content);
$build += array(
'#theme' => 'scald_atom',
);
// Allow modules to modify the structured atom.
$type = 'scald_atom';
drupal_alter(array(
'scald_atom_view',
'entity_view',
), $build, $type);
return $build;
}