Download the PHP package memdev/silverstripe-templatehooks without Composer
On this page you can find all versions of the php package memdev/silverstripe-templatehooks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download memdev/silverstripe-templatehooks
More information about memdev/silverstripe-templatehooks
Files in memdev/silverstripe-templatehooks
Package silverstripe-templatehooks
Short Description TemplateHooks enables developers to hook into user (=developer) defined hook points within SilverStripe template files.
License BSD-3-Clause
Homepage https://github.com/memdev/silverstripe-templatehooks
Informations about the package silverstripe-templatehooks
Template Hooks for SilverStripe
A simple template hook system for SilverStripe.
Sometimes extending / overriding a template is not enough or would produce a lot of duplicate markup. Maybe you just want to inject some markup at a specific point in your template file. This is where template hooks come into play.
With template hooks, you can add named "injection points" everywhere in your SilverStripe template files and hook into them from within your Controllers or DataObjects.
Requirements
- silverstripe/framework 3.1+
Installation
You'll need to do a flush by appending ?flush=1
to your site's URL.
Usage
To add a hook point to your template, simply call $TemplateHook()
, providing a name for this hook as the first parameter:
You can subscribe to this hook by calling hookInto()
in your Controller or DataObject:
You can also pass parameters with the template hook:
It will be available in your subscriber function:
Documentation
TODO
Reporting Issues
Please create an issue for any bugs you've found, or features you're missing.