I have made a few node custom modules and now need to create php versions.
Can anybody see why this hello world module does not work?
{
type: 'custom',
module : 'custom',
action : 'order_submit',
groupTitle : 'Custom Actions',
groupIcon : 'fas fa-lg fa-database comp-data',
title : 'Order Submit @@var(actionName)@@',
icon : 'fas fa-lg fa-table comp-data',
dataScheme: [
{name: 'response', type: 'text'}
],
dataPickObject: true,
properties : [
{
group: 'Order Submit Properties',
variables: [
{ name: 'actionName', optionName: 'name', title: 'Name',
type: 'text', required: true, defaultValue: ''},
{ name: 'output', optionName: 'output', title: 'Output', type: 'boolean', defaultValue: false }
]
}
]
}
<?php
namespace modules;
use \lib\core\Module;
class custom extends Module
{
public function setvalue($options, $name) {
$myObj->response = "Hello World";
return json_encode($myObj);
}
}
?>
{
"code": 0,
"file": "/opt/bitnami/apache/htdocs/dmxConnectLib/lib/App.php",
"line": 197,
"message": "Object of class modules\\custom could not be converted to string",
"trace": "#0 /opt/bitnami/apache/htdocs/dmxConnectLib/lib/App.php(127): lib\\App->execSteps()\n#1 /opt/bitnami/apache/htdocs/dmxConnectLib/lib/App.php(94): lib\\App->exec()\n#2 /opt/bitnami/apache/htdocs/dmxConnect/api/abc.php(8): lib\\App->define()\n#3 {main}"
}
The error message seems to have an extra backslash – or is that just escaped???