forked from adampatterson/Tentacle
-
Notifications
You must be signed in to change notification settings - Fork 1
Creating a plugin
adampatterson edited this page Jan 22, 2013
·
17 revisions
Tentacle has a really great event and trigger system, Plugins can take full advantage of all core features in Tentacle.
Every plugin must have a file the matches the folders name.
- {plugin_name}/{plugin_name}.php
The plugin file must contain valid YAML insed a DocBlock at the top of your PHP file, the following meta data should be used.
This is the brains of the whole operation, Everything your plugin does will be controlled here.
A bare bones plugin will be comprised of two elements, The registration of an event, and the actual event that is triggered.
<?
/**
name: Plugin Name
url: http://tentaclecms.com
version: 1.0
description: Tentacles core Plugin
author:
name: Adam Patterson
url: http://adampatterson.ca
*/
This information will be displayed in the admin/settings_plugin/ page.
Here is an example of a very simple plugin.
<?php
/**
name: Ipsum
url: http://chyrp.net/
version: 1.0
description: Generates Lorem Ipsum content.
author:
name: the Chyrp Team
url: http://chyrp.net/
*/
event::on('preview', 'ipsum::get', 1);
class ipsum
{
static function get( $text='' )
{
return str_replace('[ipsum]', file_get_contents('http://loripsum.net/api'), $text);
}
}
Read more on Events