diff options
author | redmatrix <git@macgirvin.com> | 2016-04-21 22:16:57 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-04-21 22:16:57 -0700 |
commit | a3ce194bf52c6db63513754b0c3e8676928a2cfd (patch) | |
tree | f8cc64af5f379c313436663aa9f042b9a556e97b /doc | |
parent | 5a427dcee3ca9bce3fcb5de6a67292a405ee6736 (diff) | |
download | volse-hubzilla-a3ce194bf52c6db63513754b0c3e8676928a2cfd.tar.gz volse-hubzilla-a3ce194bf52c6db63513754b0c3e8676928a2cfd.tar.bz2 volse-hubzilla-a3ce194bf52c6db63513754b0c3e8676928a2cfd.zip |
Some issues discovered with linkinfo module, and update the doco about using object modules in addons; as there were a couple of surprises.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/plugins.bb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/doc/plugins.bb b/doc/plugins.bb index 9bcefdd3b..f1e3622d6 100644 --- a/doc/plugins.bb +++ b/doc/plugins.bb @@ -208,10 +208,16 @@ Sometimes your plugins want to provide a range of new functionality which isn't There are two ways to accomplish this. To create a module object use the following model:
[code]
+<?php /* file: addon/randplace/Mod_Randplace.php */
+namespace Zotlabs\Module;
// Your module will consist of the name of your addon with an uppercase first character, within the Zotlabs\Module namespace
-
- class Zotlabs\Module\Randplace extends Zotlabs\Web\Controller {
+ // To avoid namespace conflicts with your plugin, the convention we're using is to name the module file Mod_Addonname.php
+ // In this case 'Mod_Randplace.php' and then include it from within your main plugin file 'randplace.php' with the line:
+ //
+ // require_once('addon/randplace/Mod_Randplace.php');
+
+ class Randplace extends \Zotlabs\Web\Controller {
function init() {
// init method is always called first if it exists
}
@@ -226,7 +232,9 @@ There are two ways to accomplish this. To create a module object use the followi [/code]
The other option is to use a procedural interface. The $a argument to these function is obsolete, but must be present.
-The key to this is to create a simple function named pluginname_module() which does nothing.
+The key to this is to create a simple function named pluginname_module() which does nothing. These lines and this interface
+can be used inside your addon file without causing a namespace conflict, as the object method will.
+
[code]
function randplace_module() { return; }
[/code]
|