You are here

function template_preprocess_scald_atom in Scald: Media Management made easy 7

Processes variables for scald-atom.tpl.php.

The $variables array contains the following arguments:

  • $atom
  • $view_mode.

See also

scald-atom.tpl.php

File

./scald.module, line 2542
The Scald Core, which handles all Scald Registries and dispatch.

Code

function template_preprocess_scald_atom(&$variables) {
  $variables['view_mode'] = $variables['elements']['#view_mode'];
  $variables['atom'] = $variables['elements']['#entity'];

  // In DS Token support, it requires entity to be accessed by entity name.
  // Maybe we should get rid of one of these?
  $variables['scald_atom'] = $variables['elements']['#entity'];
  $atom = $variables['atom'];

  // Flatten the scald_atom object's member fields.
  $variables = array_merge((array) $atom, $variables);

  // Helpful $content variable for templates.
  $variables += array(
    'content' => array(),
  );
  foreach (element_children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }

  // Make the field variables available with the appropriate language.
  field_attach_preprocess('scald_atom', $atom, $variables['content'], $variables);

  // Clean up name so there are no underscores.
  $variables['theme_hook_suggestions'][] = 'scald_atom__' . $atom->type;
}