Hi guy,
I have tried to add new function Getlastword in string group as below path:
application/Espo/Core/Formula/Functions/StringGroup/GetlastwordType.php
code:
namespace Espo\Core\Formula\Functions\StringGroup;
use \Espo\Core\Exceptions\Error;
class getlastword extends \Espo\Core\Formula\Functions\Base
{
public function process(\StdClass $item)
{
if (!property_exists($item, 'value')) {
return '';
}
if (!is_array($item->value)) {
throw new Error();
}
if (count($item->value) < 1) {
throw new Error();
}
$value = $this->evaluate($item->value);
$php_pot = strripos($value,' ');
return substr($value,$php_pot);
}
}
Then I this function to function list as path:
custom/Espo/Custom/Resources/metadata/app/formula.json
formular.json file:
{
"functionList": [
{
"name": "string\\Getlastword",
"insertText": "string\\Getlastword(String)"
}
]
}
But it's not working.Please help if I do wrong.
Thank you very much.
Brian.
I have tried to add new function Getlastword in string group as below path:
application/Espo/Core/Formula/Functions/StringGroup/GetlastwordType.php
code:
namespace Espo\Core\Formula\Functions\StringGroup;
use \Espo\Core\Exceptions\Error;
class getlastword extends \Espo\Core\Formula\Functions\Base
{
public function process(\StdClass $item)
{
if (!property_exists($item, 'value')) {
return '';
}
if (!is_array($item->value)) {
throw new Error();
}
if (count($item->value) < 1) {
throw new Error();
}
$value = $this->evaluate($item->value);
$php_pot = strripos($value,' ');
return substr($value,$php_pot);
}
}
Then I this function to function list as path:
custom/Espo/Custom/Resources/metadata/app/formula.json
formular.json file:
{
"functionList": [
{
"name": "string\\Getlastword",
"insertText": "string\\Getlastword(String)"
}
]
}
But it's not working.Please help if I do wrong.
Thank you very much.
Brian.
Comment