Skip to content

Instantly share code, notes, and snippets.

@adamfairholm
Created April 2, 2013 14:42
Show Gist options
  • Save adamfairholm/5292754 to your computer and use it in GitHub Desktop.
Save adamfairholm/5292754 to your computer and use it in GitHub Desktop.
Passthrough Vars Feature for PyroStreams
// -------------------------------------
// Keep Vars
// -------------------------------------
// Allow vars to pass through by doing
// keep:{var_name}={var_value}
// -------------------------------------
$keepers = array();
foreach ($this->attributes() as $key => $val)
{
if (substr($key, 0, 5) == 'keep:' and strlen($key) > 5)
{
$pieces = explode(':', $key);
$keepers[trim($pieces[1])] = $val;
}
}
if ($keepers)
{
foreach ($return['entries'] as &$entry)
{
$entry = array_merge($entry, $keepers);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment