-
Notifications
You must be signed in to change notification settings - Fork 1
Creating a module
Tentacle has a really great hook and filter system that the great guys over at Chyrp built. Modules can take full advantage of all core features in Tentacle.
Every module must have these two files to start, there must be a php file with the same name as the folder its in.
- {module_name}/info.yaml
- {module_name}/{module_name}.php
The info.yaml file must contain valid YAML and should have the following meta data.
name: Module Name
url: http://tentaclecms.com
version: 1.0
description: Tentacles core Module
author:
name: Adam Patterson
url: http://adampatterson.ca
This information is displayed in the admin/settings_modules/ page
This is the brains of the whole operation, Everything your plugin does will be controlled here.
First we need to create a class that matches the modules name.
class {module_name} extends Modules {..
You can now create two functions, One called __init() which is a magic method and the onther being the function you want to trigger {function_name}. Both must be public functions so that they can be called from external files.
Any time the {module_name}.php file is loaded the __init() function is called.
Read more on the triggers available Triggers.
<?php
class {module_name} extends Modules {
public function __init() {
$this->addAlias("preview","{function_name}");
// Code block
}
public function {function_name}() {
// Code block
return $something;
}
}