Added option to dynamicly set the sub-form layout from global options. Fixed bug in compiler that caused index warning.

This commit is contained in:
2020-07-13 04:52:06 +02:00
parent 25afc31e7f
commit 3a5681ce43
21 changed files with 219 additions and 30 deletions

View File

@ -111,7 +111,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeUpdateFiles
$this->triggerEvent(
'jcb_ce_onBeforeUpdateFiles',
array(&$this->componentContext, $this)
array(&$this->componentContext, &$this)
);
// now update the files
if (!$this->updateFiles())
@ -121,7 +121,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeGetCustomCode
$this->triggerEvent(
'jcb_ce_onBeforeGetCustomCode',
array(&$this->componentContext, $this)
array(&$this->componentContext, &$this)
);
// now insert into the new files
if ($this->getCustomCode())
@ -129,7 +129,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeAddCustomCode
$this->triggerEvent(
'jcb_ce_onBeforeAddCustomCode',
array(&$this->componentContext, $this)
array(&$this->componentContext, &$this)
);
$this->addCustomCode();
@ -137,7 +137,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeSetLangFileData
$this->triggerEvent(
'jcb_ce_onBeforeSetLangFileData',
array(&$this->componentContext, $this)
array(&$this->componentContext, &$this)
);
// set the lang data now
$this->setLangFileData();

View File

@ -835,7 +835,7 @@ class Get
}
}
// Trigger Event: jcb_ce_onBeforeGet
$this->triggerEvent('jcb_ce_onBeforeGet', array(&$config, $this));
$this->triggerEvent('jcb_ce_onBeforeGet', array(&$config, &$this));
// set the Joomla version
$this->joomlaVersion = $config['version'];
// set the minfy switch of the JavaScript
@ -923,14 +923,14 @@ class Get
// Trigger Event: jcb_ce_onBeforeGetComponentData
$this->triggerEvent(
'jcb_ce_onBeforeGetComponentData',
array(&$this->componentContext, $this)
array(&$this->componentContext, &$this)
);
// get the component data
$this->componentData = $this->getComponentData();
// Trigger Event: jcb_ce_onAfterGetComponentData
$this->triggerEvent(
'jcb_ce_onAfterGetComponentData',
array(&$this->componentContext, $this)
array(&$this->componentContext, &$this)
);
// make sure we have a version
if (strpos($this->componentData->component_version, '.')
@ -969,7 +969,7 @@ class Get
// Trigger Event: jcb_ce_onBeforeGet
$this->triggerEvent(
'jcb_ce_onAfterGet', array(&$this->componentContext, $this)
'jcb_ce_onAfterGet', array(&$this->componentContext, &$this)
);
return true;

View File

@ -4194,7 +4194,7 @@ class Fields extends Structure
= '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB';
foreach ($phpTracker as $searchKey => $phpKey)
{
// we must search for more code in the xml just incase
// we must search for more code in the xml just encase
foreach (range(2, 30) as $phpLine)
{
$get_ = $searchKey . '_' . $phpLine;
@ -4953,17 +4953,16 @@ class Fields extends Structure
$replace = array(
$this->bbb . 'JPREFIX' . $this->ddd => $jprefix,
$this->bbb . 'TABLE'
. $this->ddd => $data['custom']['table'],
. $this->ddd => (isset($data['custom']['table'])) ? $data['custom']['table'] :'',
$this->bbb . 'ID'
. $this->ddd => $data['custom']['id'],
. $this->ddd => (isset($data['custom']['id'])) ? $data['custom']['id'] :'',
$this->bbb . 'TEXT'
. $this->ddd => $data['custom']['text'],
$this->bbb . 'CODE_TEXT' . $this->ddd => $data['code'] . '_'
. $data['custom']['text'],
$this->bbb . 'CODE' . $this->ddd => $data['code'],
. $this->ddd => (isset($data['custom']['text'])) ? $data['custom']['text'] :'',
$this->bbb . 'CODE_TEXT' . $this->ddd => (isset($data['code'], $data['custom']['text'])) ? $data['code'] . '_' . $data['custom']['text'] :'',
$this->bbb . 'CODE' . $this->ddd => (isset($data['code'])) ? $data['code'] :'',
$this->bbb . 'view_type' . $this->ddd => $view_name_single
. '_' . $data['type'],
$this->bbb . 'type' . $this->ddd => $data['type'],
$this->bbb . 'type' . $this->ddd => (isset($data['type'])) ? $data['type'] :'',
$this->bbb . 'com_component'
. $this->ddd => (isset($data['custom']['component'])
&& ComponentbuilderHelper::checkString(

View File

@ -25193,7 +25193,7 @@ function vdm_dkim() {
// Trigger Event: jcb_ce_onBeforeBuildAccessSections
$this->triggerEvent(
'jcb_ce_onBeforeBuildAccessSections',
array(&$this->componentContext, $this)
array(&$this->componentContext, &$this)
);
$this->componentHead[] = '<section name="component">';
@ -25620,7 +25620,7 @@ function vdm_dkim() {
// Trigger Event: jcb_ce_onAfterBuildAccessSections
$this->triggerEvent(
'jcb_ce_onAfterBuildAccessSections',
array(&$this->componentContext, $this)
array(&$this->componentContext, &$this)
);
// set the views permissions now

View File

@ -1934,7 +1934,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onBeforeInfuseModuleData
$this->triggerEvent(
'jcb_ce_onBeforeInfuseModuleData',
array(&$this->componentContext, &$module, $this)
array(&$this->componentContext, &$module, &$this)
);
$this->target = $module->key;
$this->lang = $module->key;
@ -1998,7 +1998,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onAfterInfuseModuleData
$this->triggerEvent(
'jcb_ce_onAfterInfuseModuleData',
array(&$this->componentContext, &$module, $this)
array(&$this->componentContext, &$module, &$this)
);
}
}
@ -2013,7 +2013,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onBeforeInfusePluginData
$this->triggerEvent(
'jcb_ce_onBeforeInfusePluginData',
array(&$this->componentContext, &$plugin, $this)
array(&$this->componentContext, &$plugin, &$this)
);
$this->target = $plugin->key;
$this->lang = $plugin->key;
@ -2060,7 +2060,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onAfterInfusePluginData
$this->triggerEvent(
'jcb_ce_onAfterInfusePluginData',
array(&$this->componentContext, &$plugin, $this)
array(&$this->componentContext, &$plugin, &$this)
);
}
}

View File

@ -5864,6 +5864,47 @@ abstract class ComponentbuilderHelper
return $d && $d->format($format) == $date;
}
/**
* The subform layouts
**/
protected static $subformLayouts = false;
/**
* get the subform layout
*
* @input string The view name
* @input string The string name
*
* @returns string on success
**/
public static function getSubformLayout($view, $field, $default = 'repeatablejcb')
{
// get global values
if (self::$subformLayouts === false)
{
self::$subformLayouts = JComponentHelper::getParams('com_componentbuilder')->get('subform_layouts', false);
}
// check what we found (else) return default
if (self::checkObject(self::$subformLayouts))
{
// looking for
$target = $view . '.' . $field;
foreach (self::$subformLayouts as $subform)
{
if ($target === $subform->view_field)
{
return $subform->layout;
}
elseif ('default' === $subform->view_field)
{
$default = $subform->layout;
}
}
}
return $default;
}
/**
* Load the Composer Vendors