Created
April 2, 2013 14:42
-
-
Save adamfairholm/5292754 to your computer and use it in GitHub Desktop.
Passthrough Vars Feature for PyroStreams
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------- | |
// 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