Improved the layout compiler methods.

This commit is contained in:
Llewellyn van der Merwe 2020-12-31 13:18:52 +02:00
parent d29bc8f3a0
commit 75fa49e517
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
7 changed files with 529 additions and 195 deletions

View File

@ -143,7 +143,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*: 27th December, 2020 + *Last Build*: 31st December, 2020
+ *Version*: 2.12.4 + *Version*: 2.12.4
+ *Copyright*: Copyright (C) 2015 - 2021 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2021 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

@ -143,7 +143,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*: 27th December, 2020 + *Last Build*: 31st December, 2020
+ *Version*: 2.12.4 + *Version*: 2.12.4
+ *Copyright*: Copyright (C) 2015 - 2021 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2021 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

@ -0,0 +1,20 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');###OVERRIDE_LAYOUT_CODE###
?>###OVERRIDE_LAYOUT_BODY###

View File

@ -386,6 +386,11 @@
"rename": "layout_admin", "rename": "layout_admin",
"type": "layout" "type": "layout"
}, },
"layoutoverride.php": {
"path": "c0mp0n3nt/admin/layouts/VIEW",
"rename": "layoutoverride",
"type": "layoutoverride"
},
"layoutitems.php": { "layoutitems.php": {
"path": "c0mp0n3nt/admin/layouts/VIEW", "path": "c0mp0n3nt/admin/layouts/VIEW",
"rename": "layoutitems", "rename": "layoutitems",
@ -576,6 +581,11 @@
"rename": "layout_site", "rename": "layout_site",
"type": "layout" "type": "layout"
}, },
"layoutoverride.php": {
"path": "c0mp0n3nt/site/layouts/VIEW",
"rename": "layoutoverride",
"type": "layoutoverride"
},
"layoutitems.php": { "layoutitems.php": {
"path": "c0mp0n3nt/site/layouts/VIEW", "path": "c0mp0n3nt/site/layouts/VIEW",
"rename": "layoutitems", "rename": "layoutitems",

View File

@ -787,6 +787,13 @@ class Get
*/ */
public $updateSQL = array(); public $updateSQL = array();
/**
* The data by alias keys
*
* @var array
*/
protected $dataWithAliasKeys = array();
/** /**
* The Library Manager * The Library Manager
* *
@ -5791,11 +5798,19 @@ class Get
* @param string $default The content to check * @param string $default The content to check
* @param string $view The view code name * @param string $view The view code name
* @param boolean $found The proof that something was found * @param boolean $found The proof that something was found
* @param array $templates The option to pass templates keys (to avoid search)
* @param array $layouts The option to pass layout keys (to avoid search)
* *
* @return boolean if something was found true * @return boolean if something was found true
* *
*/ */
public function setTemplateAndLayoutData($default, $view, $found = false) public function setTemplateAndLayoutData($default, $view, $found = false,
$templates = array(), $layouts = array()
) {
// to check inside the templates
$again = array();
// check if template keys were passed
if (!ComponentbuilderHelper::checkArray($templates))
{ {
// set the Template data // set the Template data
$temp1 = ComponentbuilderHelper::getAllBetween( $temp1 = ComponentbuilderHelper::getAllBetween(
@ -5804,8 +5819,6 @@ class Get
$temp2 = ComponentbuilderHelper::getAllBetween( $temp2 = ComponentbuilderHelper::getAllBetween(
$default, '$this->loadTemplate("', '")' $default, '$this->loadTemplate("', '")'
); );
$templates = array();
$again = array();
if (ComponentbuilderHelper::checkArray($temp1) if (ComponentbuilderHelper::checkArray($temp1)
&& ComponentbuilderHelper::checkArray($temp2)) && ComponentbuilderHelper::checkArray($temp2))
{ {
@ -5822,7 +5835,9 @@ class Get
$templates = $temp2; $templates = $temp2;
} }
} }
if (ComponentbuilderHelper::checkArray($templates)) }
// check if we found templates
if (ComponentbuilderHelper::checkArray($templates, true))
{ {
foreach ($templates as $template) foreach ($templates as $template)
{ {
@ -5845,20 +5860,24 @@ class Get
} }
} }
// check if we have the template set (and nothing yet found) // check if we have the template set (and nothing yet found)
if (!$found && isset($this->templateData[$this->target][$view][$template])) if (!$found
&& isset($this->templateData[$this->target][$view][$template]))
{ {
// something was found // something was found
$found = true; $found = true;
} }
} }
} }
// check if layout keys were passed
if (!ComponentbuilderHelper::checkArray($layouts))
{
// set the Layout data // set the Layout data
$lay1 = ComponentbuilderHelper::getAllBetween( $lay1 = ComponentbuilderHelper::getAllBetween(
$default, "JLayoutHelper::render('", "'," $default, "JLayoutHelper::render('", "',"
); );
$lay2 = ComponentbuilderHelper::getAllBetween( $lay2 = ComponentbuilderHelper::getAllBetween(
$default, 'JLayoutHelper::render("', '",' $default, 'JLayoutHelper::render("', '",'
);; );
if (ComponentbuilderHelper::checkArray($lay1) if (ComponentbuilderHelper::checkArray($lay1)
&& ComponentbuilderHelper::checkArray($lay2)) && ComponentbuilderHelper::checkArray($lay2))
{ {
@ -5875,8 +5894,16 @@ class Get
$layouts = $lay2; $layouts = $lay2;
} }
} }
if (isset($layouts) && ComponentbuilderHelper::checkArray($layouts)) }
// check if we found layouts
if (ComponentbuilderHelper::checkArray($layouts, true))
{ {
// get the other target if both
$_target = null;
if ($this->lang === 'both')
{
$_target = ($this->target === 'admin') ? 'site' : 'admin';
}
foreach ($layouts as $layout) foreach ($layouts as $layout)
{ {
if (!isset($this->layoutData[$this->target]) if (!isset($this->layoutData[$this->target])
@ -5892,6 +5919,11 @@ class Get
{ {
// load it to the layout data array // load it to the layout data array
$this->layoutData[$this->target][$layout] = $data; $this->layoutData[$this->target][$layout] = $data;
// check if other target is set
if ($this->lang === 'both' && $_target)
{
$this->layoutData[$_target][$layout] = $data;
}
// call self to get child data // call self to get child data
$again[] = array($data['html'], $view); $again[] = array($data['html'], $view);
$again[] = array($data['php_view'], $view); $again[] = array($data['php_view'], $view);
@ -5905,13 +5937,17 @@ class Get
} }
} }
} }
// check again
if (ComponentbuilderHelper::checkArray($again)) if (ComponentbuilderHelper::checkArray($again))
{ {
foreach ($again as $go) foreach ($again as $go)
{ {
$found = $this->setTemplateAndLayoutData($go[0], $go[1], $found); $found = $this->setTemplateAndLayoutData(
$go[0], $go[1], $found
);
} }
} }
// return the proof that something was found // return the proof that something was found
return $found; return $found;
} }
@ -5928,19 +5964,39 @@ class Get
*/ */
protected function getDataWithAlias($n_ame, $table, $view) protected function getDataWithAlias($n_ame, $table, $view)
{ {
// if not set, get all keys in table and set by ID
$this->setDataWithAliasKeys($table);
// now check if key is found
$name = preg_replace("/[^A-Za-z]/", '', $n_ame);
if (isset($this->dataWithAliasKeys[$table][$name]))
{
$ID = $this->dataWithAliasKeys[$table][$name];
}
elseif (isset($this->dataWithAliasKeys[$table][$n_ame]))
{
$ID = $this->dataWithAliasKeys[$table][$n_ame];
}
else
{
return false;
}
// Create a new query object. // Create a new query object.
$query = $this->db->getQuery(true); $query = $this->db->getQuery(true);
$query->select('a.*'); $query->select('a.*');
$query->from('#__componentbuilder_' . $table . ' AS a'); $query->from('#__componentbuilder_' . $table . ' AS a');
$query->where(
$this->db->quoteName('a.id') . ' = ' . (int) $ID
);
// get the other target if both
$_targets = array($this->target);
if ($this->lang === 'both')
{
$_targets = array('site', 'admin');
}
$this->db->setQuery($query); $this->db->setQuery($query);
$rows = $this->db->loadObjectList(); // get the row
foreach ($rows as $row) $row = $this->db->loadObject();
{ // we load this layout
$k_ey = ComponentbuilderHelper::safeString($row->alias);
$key = preg_replace("/[^A-Za-z]/", '', $k_ey);
$name = preg_replace("/[^A-Za-z]/", '', $n_ame);
if ($k_ey == $n_ame || $key == $name)
{
$php_view = ''; $php_view = '';
if ($row->add_php_view == 1 if ($row->add_php_view == 1
&& ComponentbuilderHelper::checkString($row->php_view)) && ComponentbuilderHelper::checkString($row->php_view))
@ -5962,14 +6018,17 @@ class Get
'id' => (int) $row->id, 'id' => (int) $row->id,
'type' => 'html') 'type' => 'html')
); );
// load all targets
foreach ($_targets as $_target)
{
// load the library // load the library
if (!isset($this->libManager[$this->target])) if (!isset($this->libManager[$_target]))
{ {
$this->libManager[$this->target] = array(); $this->libManager[$_target] = array();
} }
if (!isset($this->libManager[$this->target][$view])) if (!isset($this->libManager[$_target][$view]))
{ {
$this->libManager[$this->target][$view] = array(); $this->libManager[$_target][$view] = array();
} }
// make sure json become array // make sure json become array
if (ComponentbuilderHelper::checkJson($row->libraries)) if (ComponentbuilderHelper::checkJson($row->libraries))
@ -5981,25 +6040,66 @@ class Get
{ {
foreach ($row->libraries as $library) foreach ($row->libraries as $library)
{ {
if (!isset($this->libManager[$this->target][$view][$library])) if (!isset($this->libManager[$_target][$view][$library]))
{ {
if ($this->getMediaLibrary((int) $library)) if ($this->getMediaLibrary((int) $library))
{ {
$this->libManager[$this->target][$view][(int) $library] $this->libManager[$_target][$view][(int) $library]
= true; = true;
} }
} }
} }
} }
elseif (is_numeric($row->libraries) elseif (is_numeric($row->libraries)
&& !isset($this->libManager[$this->target][$view][(int) $row->libraries])) && !isset($this->libManager[$_target][$view][(int) $row->libraries]))
{ {
if ($this->getMediaLibrary((int) $row->libraries)) if ($this->getMediaLibrary((int) $row->libraries))
{ {
$this->libManager[$this->target][$view][(int) $row->libraries] $this->libManager[$_target][$view][(int) $row->libraries]
= true; = true;
} }
} }
// set footable to views and turn it on
if (!isset($this->footableScripts[$_target][$view])
|| !$this->footableScripts[$_target][$view])
{
$foundFoo = $this->getFootableScripts($contnent);
if ($foundFoo)
{
$this->footableScripts[$_target][$view] = true;
}
if ($foundFoo && !$this->footable)
{
$this->footable = true;
}
}
// set google charts to views and turn it on
if (!isset($this->googleChart[$_target][$view])
|| !$this->googleChart[$_target][$view])
{
$foundA = $this->getGoogleChart($php_view);
$foundB = $this->getGoogleChart($contnent);
if ($foundA || $foundB)
{
$this->googleChart[$_target][$view] = true;
}
if ($foundA || $foundB && !$this->googlechart)
{
$this->googlechart = true;
}
}
// check for get module
if (!isset($this->getModule[$_target][$view])
|| !$this->getModule[$_target][$view])
{
$foundA = $this->getGetModule($php_view);
$foundB = $this->getGetModule($contnent);
if ($foundA || $foundB)
{
$this->getModule[$_target][$view] = true;
}
}
}
// load UIKIT if needed // load UIKIT if needed
if (2 == $this->uikit || 1 == $this->uikit) if (2 == $this->uikit || 1 == $this->uikit)
{ {
@ -6013,46 +6113,6 @@ class Get
$contnent, $this->uikitComp[$view] $contnent, $this->uikitComp[$view]
); );
} }
// set footable to views and turn it on
if (!isset($this->footableScripts[$this->target][$view])
|| !$this->footableScripts[$this->target][$view])
{
$foundFoo = $this->getFootableScripts($contnent);
if ($foundFoo)
{
$this->footableScripts[$this->target][$view] = true;
}
if ($foundFoo && !$this->footable)
{
$this->footable = true;
}
}
// set google charts to views and turn it on
if (!isset($this->googleChart[$this->target][$view])
|| !$this->googleChart[$this->target][$view])
{
$foundA = $this->getGoogleChart($php_view);
$foundB = $this->getGoogleChart($contnent);
if ($foundA || $foundB)
{
$this->googleChart[$this->target][$view] = true;
}
if ($foundA || $foundB && !$this->googlechart)
{
$this->googlechart = true;
}
}
// check for get module
if (!isset($this->getModule[$this->target][$view])
|| !$this->getModule[$this->target][$view])
{
$foundA = $this->getGetModule($php_view);
$foundB = $this->getGetModule($contnent);
if ($foundA || $foundB)
{
$this->getModule[$this->target][$view] = true;
}
}
return array( return array(
'id' => $row->id, 'id' => $row->id,
@ -6076,9 +6136,43 @@ class Get
) )
); );
} }
}
return false; /**
* set Data With Alias Keys
*
* @param string $table The table where to find the alias
*
* @return void
*
*/
protected function setDataWithAliasKeys($table)
{
// now check if key is found
if (!isset($this->dataWithAliasKeys[$table]))
{
// load this table keys
$this->dataWithAliasKeys[$table] = array();
// Create a new query object.
$query = $this->db->getQuery(true);
$query->select(array('a.id', 'a.alias'));
$query->from('#__componentbuilder_' . $table . ' AS a');
$this->db->setQuery($query);
$rows = $this->db->loadObjectList();
// check if we have an array
if (ComponentbuilderHelper::checkArray($rows))
{
foreach ($rows as $row)
{
// build the key
$k_ey = ComponentbuilderHelper::safeString($row->alias);
$key = preg_replace("/[^A-Za-z]/", '', $k_ey);
// set the keys
$this->dataWithAliasKeys[$table][$row->alias] = $row->id;
$this->dataWithAliasKeys[$table][$k_ey] = $row->id;
$this->dataWithAliasKeys[$table][$key] = $row->id;
}
}
}
} }
/** /**
@ -6091,7 +6185,6 @@ class Get
*/ */
protected function getMediaLibrary($id) protected function getMediaLibrary($id)
{ {
// check if the lib has already been set // check if the lib has already been set
if (!isset($this->libraries[$id])) if (!isset($this->libraries[$id]))
{ {

View File

@ -12116,7 +12116,6 @@ class Interpretation extends Fields
$COMPONENT = strtoupper($component); $COMPONENT = strtoupper($component);
// set uppercase view // set uppercase view
$VIEWS = strtoupper($nameListCode); $VIEWS = strtoupper($nameListCode);
// build the body // build the body
$body = array(); $body = array();
// check if the filter type is sidebar (1 = sidebar) // check if the filter type is sidebar (1 = sidebar)
@ -12146,6 +12145,14 @@ class Interpretation extends Fields
$body[] = $this->_t(1) . "}"; $body[] = $this->_t(1) . "}";
$body[] = "</script>"; $body[] = "</script>";
} }
// Trigger Event: jcb_ce_onSetDefaultViewsBodyTop
$this->triggerEvent(
'jcb_ce_onSetDefaultViewsBodyTop',
array(&$this,
&$body,
&$nameSingleCode,
&$nameListCode)
);
$body[] = "<form action=\"<?php echo JRoute::_('index.php?option=com_" $body[] = "<form action=\"<?php echo JRoute::_('index.php?option=com_"
. $component . "&view=" . $nameListCode . $component . "&view=" . $nameListCode
. "'); ?>\" method=\"post\" name=\"adminForm\" id=\"adminForm\">"; . "'); ?>\" method=\"post\" name=\"adminForm\" id=\"adminForm\">";
@ -12159,6 +12166,14 @@ class Interpretation extends Fields
$body[] = "<?php else : ?>"; $body[] = "<?php else : ?>";
$body[] = $this->_t(1) . "<div id=\"j-main-container\">"; $body[] = $this->_t(1) . "<div id=\"j-main-container\">";
$body[] = "<?php endif; ?>"; $body[] = "<?php endif; ?>";
// Trigger Event: jcb_ce_onSetDefaultViewsFormTop
$this->triggerEvent(
'jcb_ce_onSetDefaultViewsFormTop',
array(&$this,
&$body,
&$nameSingleCode,
&$nameListCode)
);
// check if the filter type is sidebar (2 = topbar) // check if the filter type is sidebar (2 = topbar)
if (isset($this->adminFilterType[$nameListCode]) if (isset($this->adminFilterType[$nameListCode])
&& $this->adminFilterType[$nameListCode] == 2) && $this->adminFilterType[$nameListCode] == 2)
@ -12247,7 +12262,23 @@ class Interpretation extends Fields
$body[] = $this->_t(1) $body[] = $this->_t(1)
. "<input type=\"hidden\" name=\"task\" value=\"\" />"; . "<input type=\"hidden\" name=\"task\" value=\"\" />";
$body[] = $this->_t(1) . "<?php echo JHtml::_('form.token'); ?>"; $body[] = $this->_t(1) . "<?php echo JHtml::_('form.token'); ?>";
// Trigger Event: jcb_ce_onSetDefaultViewsFormBottom
$this->triggerEvent(
'jcb_ce_onSetDefaultViewsFormBottom',
array(&$this,
&$body,
&$nameSingleCode,
&$nameListCode)
);
$body[] = "</form>"; $body[] = "</form>";
// Trigger Event: jcb_ce_onSetDefaultViewsBodyBottom
$this->triggerEvent(
'jcb_ce_onSetDefaultViewsBodyBottom',
array(&$this,
&$body,
&$nameSingleCode,
&$nameListCode)
);
return implode(PHP_EOL, $body); return implode(PHP_EOL, $body);
} }
@ -12503,9 +12534,7 @@ class Interpretation extends Fields
public function setEditBody(&$view) public function setEditBody(&$view)
{ {
// set view name // set view name
$nameSingleCode = ComponentbuilderHelper::safeString( $nameSingleCode = $view['settings']->name_single_code;
$view['settings']->name_single
);
// main lang prefix // main lang prefix
$langView = $this->langPrefix . '_' $langView = $this->langPrefix . '_'
. ComponentbuilderHelper::safeString($nameSingleCode, 'U'); . ComponentbuilderHelper::safeString($nameSingleCode, 'U');
@ -12805,7 +12834,7 @@ class Interpretation extends Fields
$tabs = array(); $tabs = array();
// sort the tabs based on key order // sort the tabs based on key order
ksort($this->tabCounter[$nameSingleCode]); ksort($this->tabCounter[$nameSingleCode]);
// start tab builinging loop // start tab building loop
foreach ($this->tabCounter[$nameSingleCode] as $tabNr => $tabName) foreach ($this->tabCounter[$nameSingleCode] as $tabNr => $tabName)
{ {
$tabWidth = 12; $tabWidth = 12;
@ -13515,6 +13544,9 @@ class Interpretation extends Fields
* @param $type * @param $type
*/ */
public function setLayout($nameSingleCode, $layoutName, $items, $type) public function setLayout($nameSingleCode, $layoutName, $items, $type)
{
// we check if there is a local override
if (!$this->setLayoutOverride($nameSingleCode, $layoutName, $items))
{ {
// first build the layout file // first build the layout file
$target = array('admin' => $nameSingleCode); $target = array('admin' => $nameSingleCode);
@ -13540,6 +13572,185 @@ class Interpretation extends Fields
= 'boom'; = 'boom';
} }
} }
}
/**
* @param string $nameSingleCode
* @param string $layoutName
* @param string $items
*
* @return boolean true if override was found
*/
protected function setLayoutOverride($nameSingleCode, $layoutName, $items)
{
if (($data = $this->getLayoutOverride($nameSingleCode, $layoutName))
!== false)
{
// first build the layout file
$target = array('admin' => $nameSingleCode);
$this->buildDynamique($target, 'layoutoverride', $layoutName);
// add to front if needed
if ($this->lang === 'both')
{
$target = array('site' => $nameSingleCode);
$this->buildDynamique($target, 'layoutoverride', $layoutName);
}
// make sure items is an empty string (should not be needed.. but)
if (!ComponentbuilderHelper::checkString($items))
{
$items = '';
}
// set placeholder
$placeholder = $this->placeholders;
$placeholder[$this->hhh . 'LAYOUTITEMS' . $this->hhh] = $items;
// OVERRIDE_LAYOUT_CODE <<<DYNAMIC>>>
$php_view = (array) explode(PHP_EOL, $data['php_view']);
if (ComponentbuilderHelper::checkArray($php_view))
{
$php_view = PHP_EOL . PHP_EOL . implode(PHP_EOL, $php_view);
$this->fileContentDynamic[$nameSingleCode . '_'
. $layoutName][$this->hhh
. 'OVERRIDE_LAYOUT_CODE' . $this->hhh]
= $this->setPlaceholders(
$php_view, $placeholder
);
}
else
{
$this->fileContentDynamic[$nameSingleCode . '_'
. $layoutName][$this->hhh
. 'OVERRIDE_LAYOUT_CODE' . $this->hhh]
= '';
}
// OVERRIDE_LAYOUT_BODY <<<DYNAMIC>>>
$this->fileContentDynamic[$nameSingleCode . '_'
. $layoutName][$this->hhh
. 'OVERRIDE_LAYOUT_BODY' . $this->hhh]
= PHP_EOL . $this->setPlaceholders(
$data['html'], $placeholder
);
// since override was found
return true;
}
return false;
}
/**
* @param string $nameSingleCode
* @param string $layoutName
*
* @return array the layout data
*/
protected function getLayoutOverride($nameSingleCode, $layoutName)
{
// check if there is an override by component name, view name, & layout name
if ($this->setTemplateAndLayoutData(
'override', $nameSingleCode, false, array(''),
array($this->componentCodeName . $nameSingleCode . $layoutName)
))
{
$data = $this->layoutData[$this->target][$this->componentCodeName
. $nameSingleCode . $layoutName];
// remove since we will add the layout now
if ($this->lang === 'both')
{
unset(
$this->layoutData['admin'][$this->componentCodeName
. $nameSingleCode . $layoutName]
);
unset(
$this->layoutData['site'][$this->componentCodeName
. $nameSingleCode . $layoutName]
);
}
else
{
unset(
$this->layoutData[$this->target][$this->componentCodeName
. $nameSingleCode . $layoutName]
);
}
return $data;
}
// check if there is an override by component name & layout name
elseif ($this->setTemplateAndLayoutData(
'override', $nameSingleCode, false, array(''),
array($this->componentCodeName . $layoutName)
))
{
$data = $this->layoutData[$this->target][$this->componentCodeName
. $layoutName];
// remove since we will add the layout now
if ($this->lang === 'both')
{
unset(
$this->layoutData['admin'][$this->componentCodeName
. $layoutName]
);
unset(
$this->layoutData['site'][$this->componentCodeName
. $layoutName]
);
}
else
{
unset(
$this->layoutData[$this->target][$this->componentCodeName
. $layoutName]
);
}
return $data;
}
// check if there is an override by view & layout name
elseif ($this->setTemplateAndLayoutData(
'override', $nameSingleCode, false, array(''),
array($nameSingleCode . $layoutName)
))
{
$data = $this->layoutData[$this->target][$nameSingleCode
. $layoutName];
// remove since we will add the layout now
if ($this->lang === 'both')
{
unset(
$this->layoutData['admin'][$nameSingleCode . $layoutName]
);
unset($this->layoutData['site'][$nameSingleCode . $layoutName]);
}
else
{
unset($this->layoutData[$this->target][$layoutName]);
}
return $data;
}
// check if there is an override by layout name (global layout)
elseif ($this->setTemplateAndLayoutData(
'override', $nameSingleCode, false, array(''),
array($layoutName)
))
{
$data = $this->layoutData[$this->target][$layoutName];
// remove since we will add the layout now
if ($this->lang === 'both')
{
unset($this->layoutData['admin'][$layoutName]);
unset($this->layoutData['site'][$layoutName]);
}
else
{
unset($this->layoutData[$this->target][$layoutName]);
}
return $data;
}
return false;
}
/** /**
* @param $args * @param $args

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>27th December, 2020</creationDate> <creationDate>31st December, 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>