Added the community JCB package import option. Improved the jsonToString method to be more dynamic

This commit is contained in:
2018-05-02 00:17:38 +02:00
parent 8b4efd640f
commit 88dbcee380
15 changed files with 702 additions and 137 deletions

View File

@ -225,7 +225,7 @@ abstract class ###Component###Helper
return false;
}
public static function jsonToString($value, $sperator = ", ", $table = null)
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
{
// check if string is JSON
$result = json_decode($value, true);
@ -239,7 +239,7 @@ abstract class ###Component###Helper
$names = array();
foreach ($result as $val)
{
if ($name = self::getVar($table, $val, 'id', 'name'))
if ($name = self::getVar($table, $val, $id, $name))
{
$names[] = $name;
}

View File

@ -35,7 +35,7 @@ defined('_JEXEC') or die('Restricted access');
abstract class ###Component###Helper
{###SITE_GLOBAL_EVENT_HELPER### ###SITE_CUSTOM_HELPER_SCRIPT### ###BOTH_CUSTOM_HELPER_SCRIPT###
public static function jsonToString($value, $sperator = ", ", $table = null)
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
{
// check if string is JSON
$result = json_decode($value, true);
@ -49,7 +49,7 @@ abstract class ###Component###Helper
$names = array();
foreach ($result as $val)
{
if ($name = self::getVar($table, $val, 'id', 'name'))
if ($name = self::getVar($table, $val, $id, $name))
{
$names[] = $name;
}