Added the needed changes to the core compiler to manage dynamic headers per/model via pro-member-plugin. gh-548

This commit is contained in:
Llewellyn van der Merwe 2020-10-21 05:10:19 +02:00
parent 3d5ff09969
commit 2ea64446af
Signed by untrusted user: Llewellyn
GPG Key ID: EFC0C720A240551C
59 changed files with 213 additions and 137 deletions

View File

@ -144,7 +144,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 11th October, 2020 + *Last Build*: 21st October, 2020
+ *Version*: 2.11.6 + *Version*: 2.11.6
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -144,7 +144,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 11th October, 2020 + *Last Build*: 21st October, 2020
+ *Version*: 2.11.6 + *Version*: 2.11.6
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -17,9 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; ###ADMIN_VIEW_MODEL_HEADER###
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* ###Component### ###View### Model * ###Component### ###View### Model

View File

@ -17,9 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; ###SITE_ADMIN_VIEW_MODEL_HEADER###
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* ###Component### ###View### Model * ###Component### ###View### Model

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; ###CUSTOM_ADMIN_VIEW_MODEL_HEADER###
/** /**
* ###Component### ###SView### Model * ###Component### ###SView### Model

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; ###SITE_VIEW_MODEL_HEADER###
/** /**
* ###Component### ###SView### Model * ###Component### ###SView### Model

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; ###ADMIN_VIEWS_MODEL_HEADER###
/** /**
* ###Views### Model * ###Views### Model

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; ###CUSTOM_ADMIN_VIEWS_MODEL_HEADER###
/** /**
* ###Component### Model for ###SViews### * ###Component### Model for ###SViews###

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; ###SITE_VIEWS_MODEL_HEADER###
/** /**
* ###Component### Model for ###SViews### * ###Component### Model for ###SViews###

View File

@ -6953,10 +6953,6 @@ class Interpretation extends Fields
$body[] = $this->setPlaceholders( $body[] = $this->setPlaceholders(
$view['settings']->default, $this->placeholders $view['settings']->default, $this->placeholders
); );
// only load these if at-least one is not set via a custom placeholder
if (!$has_limitbox || !$has_pagescounter || !$has_pageslinks ||
!$has_pagination_start || !$has_pagination_end)
{
// add pagination start // add pagination start
if (!$has_pagination_start) if (!$has_pagination_start)
{ {
@ -6983,7 +6979,6 @@ class Interpretation extends Fields
{ {
$body[] = $this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]; $body[] = $this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd];
} }
}
// lets clear the placeholders just in case // lets clear the placeholders just in case
unset($this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd]); unset($this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd]);
unset($this->placeholders[$this->bbb . 'PAGESCOUNTER' . $this->ddd]); unset($this->placeholders[$this->bbb . 'PAGESCOUNTER' . $this->ddd]);
@ -20940,6 +20935,30 @@ class Interpretation extends Fields
return $script . $forEachStart . $fix; return $script . $forEachStart . $fix;
} }
public function setClassHeaders($context, $viewName)
{
// set the default
switch($context)
{
case 'admin.view.model':
case 'site.admin.view.model':
$header = 'use Joomla\Registry\Registry;';
$header .= PHP_EOL . 'use Joomla\String\StringHelper;';
$header .= PHP_EOL . 'use Joomla\Utilities\ArrayHelper;';
break;
default:
$header = 'use Joomla\Utilities\ArrayHelper;';
break;
}
// Trigger Event: jcb_ce_setClassHeader
$this->triggerEvent(
'jcb_ce_setClassHeader',
array(&$this->componentContext, &$context, &$viewName,
&$header)
);
return $header;
}
protected function setModelFieldRelation($item, $viewName_list, $tab) protected function setModelFieldRelation($item, $viewName_list, $tab)
{ {
$fix = ''; $fix = '';

View File

@ -614,6 +614,12 @@ class Infusion extends Interpretation
$viewName_single, $view $viewName_single, $view
); );
} }
// SITE_ADMIN_VIEW_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$viewName_single][$this->hhh
. 'SITE_ADMIN_VIEW_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
'site.admin.view.model', $viewName_single
);
} }
// TABLAYOUTFIELDSARRAY <<<DYNAMIC>>> add the tab layout fields array to the model // TABLAYOUTFIELDSARRAY <<<DYNAMIC>>> add the tab layout fields array to the model
@ -621,6 +627,13 @@ class Infusion extends Interpretation
. 'TABLAYOUTFIELDSARRAY' . $this->hhh] . 'TABLAYOUTFIELDSARRAY' . $this->hhh]
= $this->getTabLayoutFieldsArray($viewName_single); = $this->getTabLayoutFieldsArray($viewName_single);
// ADMIN_VIEW_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$viewName_single][$this->hhh
. 'ADMIN_VIEW_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
'admin.view.model', $viewName_single
);
// Trigger Event: jcb_ce_onAfterBuildAdminEditViewContent // Trigger Event: jcb_ce_onAfterBuildAdminEditViewContent
$this->triggerEvent( $this->triggerEvent(
'jcb_ce_onAfterBuildAdminEditViewContent', 'jcb_ce_onAfterBuildAdminEditViewContent',
@ -896,6 +909,13 @@ class Infusion extends Interpretation
= ''; = '';
} }
// ADMIN_VIEWS_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$viewName_list][$this->hhh
. 'ADMIN_VIEWS_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
'admin.views.model', $viewName_list
);
// Trigger Event: jcb_ce_onAfterBuildAdminListViewContent // Trigger Event: jcb_ce_onAfterBuildAdminListViewContent
$this->triggerEvent( $this->triggerEvent(
'jcb_ce_onAfterBuildAdminListViewContent', 'jcb_ce_onAfterBuildAdminListViewContent',
@ -1189,7 +1209,8 @@ class Infusion extends Interpretation
{ {
// HIDEMAINMENU <<<DYNAMIC>>> // HIDEMAINMENU <<<DYNAMIC>>>
$this->fileContentDynamic[$view['settings']->code][$this->hhh $this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'HIDEMAINMENU' . $this->hhh] = ''; . 'HIDEMAINMENU' . $this->hhh]
= '';
} }
else else
{ {
@ -1322,6 +1343,26 @@ class Infusion extends Interpretation
$view['settings']->main_get->gettype, 2 $view['settings']->main_get->gettype, 2
); );
// set headers based on the main get type
if ($view['settings']->main_get->gettype == 1)
{
// CUSTOM_ADMIN_VIEW_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'CUSTOM_ADMIN_VIEW_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
'custom.admin.view.model', $view['settings']->code
);
}
elseif ($view['settings']->main_get->gettype == 2)
{
// CUSTOM_ADMIN_VIEWS_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'CUSTOM_ADMIN_VIEWS_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
'custom.admin.views.model', $view['settings']->code
);
}
// Trigger Event: jcb_ce_onAfterBuildCustomAdminViewContent // Trigger Event: jcb_ce_onAfterBuildCustomAdminViewContent
$this->triggerEvent( $this->triggerEvent(
'jcb_ce_onAfterBuildCustomAdminViewContent', 'jcb_ce_onAfterBuildCustomAdminViewContent',
@ -1753,6 +1794,26 @@ class Infusion extends Interpretation
$view['settings']->main_get->gettype, 2 $view['settings']->main_get->gettype, 2
); );
// set headers based on the main get type
if ($view['settings']->main_get->gettype == 1)
{
// SITE_VIEW_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'SITE_VIEW_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
'site.view.model', $view['settings']->code
);
}
elseif ($view['settings']->main_get->gettype == 2)
{
// SITE_VIEWS_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'SITE_VIEWS_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
'site.views.model', $view['settings']->code
);
}
// Trigger Event: jcb_ce_onAfterBuildSiteViewContent // Trigger Event: jcb_ce_onAfterBuildSiteViewContent
$this->triggerEvent( $this->triggerEvent(
'jcb_ce_onAfterBuildSiteViewContent', 'jcb_ce_onAfterBuildSiteViewContent',

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>11th October, 2020</creationDate> <creationDate>21st October, 2020</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>