Fixed the javascript in the new relation area. Fixed gh-294 that hade count not array errors. Added the option to over-ride the column name in the new relation area.

This commit is contained in:
2018-05-29 05:45:16 +02:00
parent f7be7ddad0
commit a7c3a6e8f2
16 changed files with 120 additions and 29 deletions

View File

@ -501,6 +501,13 @@ class Get
*/
public $listJoinBuilder = array();
/**
* The list head over ride
*
* @var array
*/
public $listHeadOverRide = array();
/**
* The linked admin view tabs
*
@ -1683,6 +1690,7 @@ class Get
// prep the buckets
$this->fieldRelations[$name_list] = array();
$this->listJoinBuilder[$name_list] = array();
$this->listHeadOverRide[$name_list] = array();
// set the relations
$view->addrelations = (isset($view->addrelations) && ComponentbuilderHelper::checkJson($view->addrelations)) ? json_decode($view->addrelations, true) : null;
if (ComponentbuilderHelper::checkArray($view->addrelations))
@ -1708,6 +1716,18 @@ class Get
{
$this->listJoinBuilder[$name_list][(int) $join] = (int) $join;
}
// set header over-ride
if (isset($relationsValue['column_name']) && ComponentbuilderHelper::checkString($relationsValue['column_name']))
{
$check_column_name = trim(strtolower($relationsValue['column_name']));
// confirm it should really make the over ride
if ('default' !== $check_column_name)
{
$column_name_lang = ComponentbuilderHelper::safeString($name_list, 'U') . '_' . ComponentbuilderHelper::safeString($relationsValue['column_name'], 'U');
$this->langContent['admin'][$column_name_lang] = trim($relationsValue['column_name']);
$this->listHeadOverRide[$name_list][(int) $relationsValue['listfield']] = $column_name_lang;
}
}
}
}
}

View File

@ -6886,6 +6886,12 @@ class Interpretation extends Fields
// build the dynamic fields
foreach ($this->listBuilder[$viewName_list] as $item)
{
// check if we have an over-ride
if (isset($this->listHeadOverRide[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listHeadOverRide[$viewName_list]) && isset($this->listHeadOverRide[$viewName_list][$item['id']]))
{
$item['lang'] = $this->listHeadOverRide[$viewName_list][$item['id']];
}
// set the custom code
if (ComponentbuilderHelper::checkArray($item['custom']))
{
$item['code'] = $item['code'] . '_' . $item['custom']['text'];
@ -7953,6 +7959,11 @@ class Interpretation extends Fields
// build the dynamic fields
foreach ($this->listBuilder[$viewName_list] as $item)
{
// check if we have an over-ride
if (isset($this->listHeadOverRide[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listHeadOverRide[$viewName_list]) && isset($this->listHeadOverRide[$viewName_list][$item['id']]))
{
$item['lang'] = $this->listHeadOverRide[$viewName_list][$item['id']];
}
$setin = (2 == $this->footableVersion) ? ' data-hide="phone"' : ' data-breakpoints="xs sm"';
if ($controller > 3)
{