You are here

function _scald_sas_to_rendered_callback in Scald: Media Management made easy 7

Sas to rendered callback.

1 call to _scald_sas_to_rendered_callback()
scald_sas_to_rendered in ./scald.module
Process a text string and replace shorthands with rendered Scald Atoms.
1 string reference to '_scald_sas_to_rendered_callback'
scald_sas_to_rendered in ./scald.module
Process a text string and replace shorthands with rendered Scald Atoms.

File

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

Code

function _scald_sas_to_rendered_callback($matches, $context = NULL, $override = NULL, $allowed_contexts = NULL) {

  // Not using drupal_static here, because those static will
  // always be reset by the parent using a 'set' call before
  // they're value is actually used.
  static $callback_context, $callback_override, $callback_allowed_contexts;
  if ($matches === 'set') {
    $callback_context = $context;
    $callback_override = $override;
    $callback_allowed_contexts = $allowed_contexts;
  }
  else {
    if ($callback_override || empty($matches[2]) || !in_array($matches[2], $callback_allowed_contexts, TRUE)) {
      $render_context = $callback_context;
    }
    else {
      $render_context = $matches[2];
    }
    return scald_render($matches[1], $render_context, !empty($matches[3]) ? $matches[3] : NULL);
  }
}