Skip to content

Commit

Permalink
Add event filter that saves the event's field data in the storage
Browse files Browse the repository at this point in the history
See #9
  • Loading branch information
nilshoerrmann committed Apr 10, 2013
1 parent 699642f commit 890c6a0
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions extension.driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,43 @@ public static function providerOf($type = null) {
return self::$provides[$type];
}

public function getSubscribedDelegates() {
return array(
array(
'page' => '/blueprints/events/edit/',
'delegate' => 'AppendEventFilter',
'callback' => 'appendEventFilter'
),
array(
'page' => '/blueprints/events/new/',
'delegate' => 'AppendEventFilter',
'callback' => 'appendEventFilter'
),
array(
'page' => '/frontend/',
'delegate' => 'EventFinalSaveFilter',
'callback' => 'eventFinalSaveFilter'
)
);
}

public function appendEventFilter($context) {
$handle = 'storage-add';
$selected = (in_array($handle, $context['selected']));
$context['options'][] = Array(
$handle, $selected, __('Add to Storage')
);
}

public function eventFinalSaveFilter($context) {
$storage = new Storage();
$storage->set(
array(
'events' => array(
$context['event']->ROOTELEMENT => $context['fields']
)
)
);
}

}

0 comments on commit 890c6a0

Please sign in to comment.