diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-08-27 11:18:07 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-08-27 11:18:07 -0700 |
commit | ce43f29e2ceaac3d638061f81dc6037b5e0018d3 (patch) | |
tree | a578ffdd232d53b590b6dae68ff2bb35d6a813aa /modules/gallery/helpers | |
parent | c92d34a86b0515363f790056293cea2b0a738782 (diff) |
Refactor the display context code a bit:
1) Move the display context code into the controller themselves so that it's
more logically a continuation callback from the original controller
rendering code.
2) Simplify the display context set/get code and put it in the item helper,
it's just a couple of lines of code now.
3) Add more descriptive breadcrumb strings
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/item.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 7e779544..494c6db4 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -402,4 +402,21 @@ class item_Core { return $position; } + + /** + * Set the display context callback for any future item renders. + */ + static function set_display_context_callback() { + Cache::instance()->set("display_context_" . $sid = Session::instance()->id(), func_get_args()); + } + + /** + * Call the display context callback for the given item + */ + static function get_display_context($item) { + $args = Cache::instance()->get("display_context_" . $sid = Session::instance()->id()); + $callback = $args[0]; + $args[0] = $item; + return call_user_func_array($callback, $args); + } }
\ No newline at end of file |