PM Rest Feature: added plugins support & more improvements
from a plugin a rest class can be registered now:
on setup method add the following:
---
$this->registerRestService('Sample', [optional string: $path]);
--
and create the folder PATH_PLUGIN . /your_plugin/classes/rest
next add a class with the flowing characteristics:
<?php
class Plugin_Services_Rest_Sample
{
public function get()
{
return 'hello world';
}
}
A class prefixed with Plugin_Services_Rest_
and add the corresponding methods for a Restler api
(http://luracast.com/products/restler/)
Finally on process maker will be exposed as:
via GET: http://127.0.0.1/rest/workflow/sample
This commit is contained in:
@@ -327,6 +327,34 @@ class PMPlugin
|
||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||
return $oPluginRegistry->getSteps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a rest service and expose it
|
||||
*
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||
* @param string $coreJsFile
|
||||
* @param array/string $pluginJsFile
|
||||
* @return void
|
||||
*/
|
||||
function registerRestService($classname, $path = '')
|
||||
{
|
||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->registerRestService($this->sNamespace, $classname, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister a rest service
|
||||
*
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||
* @param string $coreJsFile
|
||||
* @param array/string $pluginJsFile
|
||||
* @return void
|
||||
*/
|
||||
function unregisterRestService($classname, $path)
|
||||
{
|
||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->unregisterRestService($this->sNamespace, $classname, $path);
|
||||
}
|
||||
}
|
||||
|
||||
class menuDetail
|
||||
|
||||
Reference in New Issue
Block a user