Skip to content

Instantly share code, notes, and snippets.

@micha149
Created February 3, 2012 11:23
Show Gist options
  • Save micha149/1729738 to your computer and use it in GitHub Desktop.
Save micha149/1729738 to your computer and use it in GitHub Desktop.
Teaser Cache Callback
<?php
/**
* Adds additional data to teaser cache
*
*
* Each Teaser will now contain the following:
* array(3) {
* [name] =>
* string(7) "Michael"
* [id] =>
* int(2) 47
* [content] =>
* string(4711) "<div><p>Rendered by selected teaser template…"
* }
*/
class Some_Callback
{
public static function onTeaserCache(Teaser_Cache_Event $event, array $params)
{
$wrap = $event->getWrap();
$event->addData('name', $wrap->find('name')->getValue('content'));
$event->addData('id', $event->getTid());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment