Added many events to the compiler as the first step to allow 3rd party integration with the compiler via plugins. gh-429

This commit is contained in:
2019-06-22 12:43:26 +02:00
parent e84105c3bd
commit 75656d940a
14 changed files with 227 additions and 21 deletions

View File

@ -68,6 +68,9 @@ class Infusion extends Interpretation
{
if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views))
{
// Trigger Event: jcb_ce_onBeforeBuildFilesContent
$this->triggerEvent('jcb_ce_onBeforeBuildFilesContent', array(&$this->componentData, &$this->fileContentStatic, &$this->fileContentDynamic, &$this->placeholders, &$this->hhh));
// COMPONENT
$this->fileContentStatic[$this->hhh . 'COMPONENT' . $this->hhh] = $this->placeholders[$this->hhh . 'COMPONENT' . $this->hhh];
@ -231,6 +234,9 @@ class Infusion extends Interpretation
// set the target
$this->target = 'admin';
$this->lang = 'admin';
// reset
$viewName_single = '';
$viewName_list = '';
// set single view
if (isset($view['settings']->name_single))
@ -269,6 +275,9 @@ class Infusion extends Interpretation
$this->setLockLicensePer($viewName_single, $this->target);
$this->setLockLicensePer($viewName_list, $this->target);
// Trigger Event: jcb_ce_onBeforeBuildAdminEditViewContent
$this->triggerEvent('jcb_ce_onBeforeBuildAdminEditViewContent', array(&$view, &$viewName_single, &$viewName_list, &$this->fileContentStatic, &$this->fileContentDynamic[$viewName_single], &$this->placeholders, &$this->hhh));
// FIELDSETS <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single][$this->hhh . 'FIELDSETS' . $this->hhh] = $this->setFieldSet($view, $this->componentCodeName, $viewName_single, $viewName_list);
@ -367,6 +376,9 @@ class Infusion extends Interpretation
$this->fileContentDynamic[$viewName_single][$this->hhh . 'SITE_MENU_XML' . $this->hhh] = $this->setAdminViewMenu($viewName_single, $view);
}
}
// Trigger Event: jcb_ce_onAfterBuildAdminEditViewContent
$this->triggerEvent('jcb_ce_onAfterBuildAdminEditViewContent', array(&$view, &$viewName_single, &$viewName_list, &$this->fileContentStatic, &$this->fileContentDynamic[$viewName_single], &$this->placeholders, &$this->hhh));
}
// set the views names
if (isset($view['settings']->name_list) && $view['settings']->name_list != 'null')
@ -376,6 +388,9 @@ class Infusion extends Interpretation
// ICOMOON <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list][$this->hhh . 'ICOMOON' . $this->hhh] = $view['icomoon'];
// Trigger Event: jcb_ce_onBeforeBuildAdminListViewContent
$this->triggerEvent('jcb_ce_onBeforeBuildAdminListViewContent', array(&$view, &$viewName_single, &$viewName_list, &$this->fileContentStatic, &$this->fileContentDynamic[$viewName_list], &$this->placeholders, &$this->hhh));
// set the export/import option
if (isset($view['port']) && $view['port'] || 1 == $view['settings']->add_custom_import)
{
@ -505,6 +520,9 @@ class Infusion extends Interpretation
{
$this->fileContentDynamic[$viewName_list][$this->hhh . 'VIEWS_FOOTER_SCRIPT' . $this->hhh] = '';
}
// Trigger Event: jcb_ce_onAfterBuildAdminListViewContent
$this->triggerEvent('jcb_ce_onAfterBuildAdminListViewContent', array(&$view, &$viewName_single, &$viewName_list, &$this->fileContentStatic, &$this->fileContentDynamic[$viewName_list], &$this->placeholders, &$this->hhh));
}
// set u fields used in batch
@ -585,6 +603,9 @@ class Infusion extends Interpretation
}
// HELPER_EXEL
$this->fileContentStatic[$this->hhh . 'HELPER_EXEL' . $this->hhh] = $this->setExelHelperMethods();
// Trigger Event: jcb_ce_onAfterBuildAdminViewContent
$this->triggerEvent('jcb_ce_onAfterBuildAdminViewContent', array(&$view, &$viewName_single, &$viewName_list, &$this->fileContentStatic, &$this->fileContentDynamic, &$this->placeholders, &$this->hhh));
}
// setup custom_admin_views and all needed stuff for the site
@ -592,7 +613,6 @@ class Infusion extends Interpretation
{
$this->target = 'custom_admin';
$this->lang = 'admin';
// var_dump($this->componentData->custom_admin_views);exit;
// start dynamic build
foreach ($this->componentData->custom_admin_views as $view)
{
@ -630,6 +650,9 @@ class Infusion extends Interpretation
$this->placeholders[$this->bbb . 'sviews' . $this->ddd] = $view['settings']->code;
$this->placeholders[$this->bbb . 'SVIEWS' . $this->ddd] = $view['settings']->CODE;
// Trigger Event: jcb_ce_onBeforeBuildCustomAdminViewContent
$this->triggerEvent('jcb_ce_onBeforeBuildCustomAdminViewContent', array(&$view, &$view['settings']->code, &$this->fileContentStatic, &$this->fileContentDynamic[$view['settings']->code], &$this->placeholders, &$this->hhh));
// set license per view if needed
$this->setLockLicensePer($view['settings']->code, $this->target);
@ -680,6 +703,9 @@ class Infusion extends Interpretation
// setup the templates
$this->setCustomViewTemplateBody($view);
// Trigger Event: jcb_ce_onAfterBuildCustomAdminViewContent
$this->triggerEvent('jcb_ce_onAfterBuildCustomAdminViewContent', array(&$view, &$view['settings']->code, &$this->fileContentStatic, &$this->fileContentDynamic[$view['settings']->code], &$this->placeholders, &$this->hhh));
}
// setup the layouts
@ -846,6 +872,9 @@ class Infusion extends Interpretation
$this->placeholders[$this->bbb . 'sviews' . $this->ddd] = $view['settings']->code;
$this->placeholders[$this->bbb . 'SVIEWS' . $this->ddd] = $view['settings']->CODE;
// Trigger Event: jcb_ce_onBeforeBuildSiteViewContent
$this->triggerEvent('jcb_ce_onBeforeBuildSiteViewContent', array(&$view, &$view['settings']->code, &$this->fileContentStatic, &$this->fileContentDynamic[$view['settings']->code], &$this->placeholders, &$this->hhh));
// set license per view if needed
$this->setLockLicensePer($view['settings']->code, $this->target);
@ -926,6 +955,9 @@ class Infusion extends Interpretation
// set the site form if needed
$this->fileContentDynamic[$view['settings']->code][$this->hhh . 'SITE_TOP_FORM' . $this->hhh] = $this->setCustomViewForm($view['settings']->code, 1);
$this->fileContentDynamic[$view['settings']->code][$this->hhh . 'SITE_BOTTOM_FORM' . $this->hhh] = $this->setCustomViewForm($view['settings']->code, 2);
// Trigger Event: jcb_ce_onAfterBuildSiteViewContent
$this->triggerEvent('jcb_ce_onAfterBuildSiteViewContent', array(&$view, &$view['settings']->code, &$this->fileContentStatic, &$this->fileContentDynamic[$view['settings']->code], &$this->placeholders, &$this->hhh));
}
// setup the layouts
$this->setCustomViewLayouts();
@ -1009,6 +1041,10 @@ class Infusion extends Interpretation
{
$this->fileContentStatic[$this->hhh . 'README' . $this->hhh] = $this->componentData->readme;
}
// Trigger Event: jcb_ce_onAfterBuildFilesContent
$this->triggerEvent('jcb_ce_onAfterBuildFilesContent', array(&$this->componentData, &$this->fileContentStatic, &$this->fileContentDynamic, &$this->placeholders, &$this->hhh));
return true;
}
return false;
@ -1136,6 +1172,9 @@ class Infusion extends Interpretation
// now we insert the values into the files
if (ComponentbuilderHelper::checkArray($this->languages))
{
// Trigger Event: jcb_ce_onBeforeBuildAllLangFiles
$this->triggerEvent('jcb_ce_onBeforeBuildAllLangFiles', array(&$this->languages, &$this->langTag));
// rest xml array
$langXML = array();
foreach ($this->languages as $tag => $areas)
{
@ -1210,7 +1249,7 @@ class Infusion extends Interpretation
$langXML[$p][] = '<language tag="' . $tag . '">language/' . $tag . '/' . $fileName . '</language>';
}
}
// load the lang xml
// load the lang xml
if (ComponentbuilderHelper::checkArray($langXML))
{
$replace = array();