-
Notifications
You must be signed in to change notification settings - Fork 20
Extension hooks
Mark Croxton edited this page Apr 15, 2016
·
16 revisions
Stash defines the following extensions hooks for use in your extensions, or in Mustash plugins.
Executed when one or more variables are deleted.
$data (array) — an associative array defining a Stash variable.
// -------------------------------------
// 'stash_delete' hook
// -------------------------------------
if ($this->EE->extensions->active_hook('stash_delete') === TRUE)
{
$this->EE->extensions->call('stash_delete', array(
'key_name' => $key_name, // string/boolean
'key_label' => $key_label, // string/boolean
'bundle_id' => $bundle_id, // integer
'session_id' => $session_id, // string, may be 'site', '_global', 'user' or a session ID
'site_id' => $site_id // integer
));
}
Executed when the entire cache for a site is cleared.
$site_id (integer) — the id of the site that has been cleared.
// -------------------------------------
// 'stash_flush_cache' hook
// -------------------------------------
if ($this->EE->extensions->active_hook('stash_flush_cache') === TRUE)
{
$this->EE->extensions->call('stash_flush_cache', $site_id);
}
Allows substituting one's own template parsing class.
// -------------------------------------
// 'stash_load_template_class' hook
// -------------------------------------
if ($this->EE->extensions->active_hook('stash_load_template_class') === TRUE)
{
$this->EE->TMPL = $this->EE->extensions->call('stash_load_template_class');
}
Called when the Stash cache is periodically pruned of expired variables (whether there are variables to evict or not).
$data (array) — an array of variables due to be evicted from the cache.
// -------------------------------------
// 'stash_prune' hook
// -------------------------------------
if ($this->EE->extensions->active_hook('stash_prune') === TRUE)
{
$this->EE->extensions->call('stash_prune', $query->result_array());
}
Getting started
Using Stash
Using Mustash
- Mustash
- Installing Mustash
- Managing variables
- Managing bundles
- Cache-breaking rules
- Mustash plugins
- Mustash Varnish plugin
- Mustash plugin development
- Mustash API
Template design patterns
Tag reference
- {exp:stash:set}
- {exp:stash:get}
- {exp:stash:block}
- {exp:stash:set_value}
- {exp:stash:append}
- {exp:stash:append_value}
- {exp:stash:prepend}
- {exp:stash:prepend_value}
- {exp:stash:copy}
- {exp:stash:context}
- {exp:stash:is_empty}
- {exp:stash:not_empty}
- {exp:stash:set_list}
- {exp:stash:get_list}
- {exp:stash:append_list}
- {exp:stash:prepend_list}
- {exp:stash:split_list}
- {exp:stash:join_lists}
- {exp:stash:list_count}
- {exp:stash:unset}
- {exp:stash:flush_cache}
- {exp:stash:bundle}
- {stash:embed}
- {exp:stash:extend}
- {exp:stash:parse}
- {exp:stash:cache}
- {exp:stash:static}
- {exp:stash:finish}
- {exp:stash:not_found}
- Short tag syntax
- Using Stash methods in your own add-ons