moved the dispatcher out of the loop
This commit is contained in:
parent
9a6ad66e32
commit
fa83ea7bc9
@ -1660,11 +1660,12 @@ class Interpretation extends Fields
|
|||||||
{
|
{
|
||||||
// build decoder string
|
// build decoder string
|
||||||
if(!$runplugins) {
|
if(!$runplugins) {
|
||||||
$runplugins = PHP_EOL."\t".$tab."\tJPluginHelper::importPlugin('content');\n";
|
$runplugins = PHP_EOL.$tab."\t//".$this->setLine(__LINE__)." Load the JEvent Dispatcher";
|
||||||
$runplugins .= PHP_EOL."\t".$tab."\t".'$dispatcher = JEventDispatcher::getInstance();';
|
$runplugins .= PHP_EOL.$tab."\tJPluginHelper::importPlugin('content');";
|
||||||
|
$runplugins .= PHP_EOL.$tab."\t".'$this->_dispatcher = JEventDispatcher::getInstance();';
|
||||||
}
|
}
|
||||||
$fieldUikit .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Make sure the content prepare plugins fire on ".$field;
|
$fieldUikit .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Make sure the content prepare plugins fire on ".$field;
|
||||||
$fieldUikit .= PHP_EOL."\t".$tab."\t".'$dispatcher->trigger("onContentPrepare",array($this->_context,&'.$string.'->'.$field.',$item->params));';
|
$fieldUikit .= PHP_EOL."\t".$tab."\t".'$this->_dispatcher->trigger("onContentPrepare",array($this->_context,&'.$string.'->'.$field.',$item->params));';
|
||||||
// only load for uikit version 2 (TODO) we may need to add another check here
|
// only load for uikit version 2 (TODO) we may need to add another check here
|
||||||
if (2 == $this->uikit || 1 == $this->uikit)
|
if (2 == $this->uikit || 1 == $this->uikit)
|
||||||
{
|
{
|
||||||
@ -1673,7 +1674,10 @@ class Interpretation extends Fields
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ($runplugins?:'').$fieldUikit;
|
// load dispatcher
|
||||||
|
$this->JEventDispatcher = array('###DISPATCHER###' => ($runplugins?:''));
|
||||||
|
// return UIKIT fix
|
||||||
|
return $fieldUikit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCustomViewCustomJoin(&$gets,$string,$code,&$asBucket,$tab = '')
|
public function setCustomViewCustomJoin(&$gets,$string,$code,&$asBucket,$tab = '')
|
||||||
@ -2128,6 +2132,8 @@ class Interpretation extends Fields
|
|||||||
$getItem .= PHP_EOL."\t".$tab."\t\treturn false;";
|
$getItem .= PHP_EOL."\t".$tab."\t\treturn false;";
|
||||||
}
|
}
|
||||||
$getItem .= PHP_EOL."\t".$tab."\t}";
|
$getItem .= PHP_EOL."\t".$tab."\t}";
|
||||||
|
// dispatcher placholder
|
||||||
|
$getItem .= "###DISPATCHER###";
|
||||||
if (ComponentbuilderHelper::checkArray($get->main_get))
|
if (ComponentbuilderHelper::checkArray($get->main_get))
|
||||||
{
|
{
|
||||||
$asBucket = array();
|
$asBucket = array();
|
||||||
@ -2208,7 +2214,8 @@ class Interpretation extends Fields
|
|||||||
$getItem .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." set data object to item.";
|
$getItem .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." set data object to item.";
|
||||||
$getItem .= PHP_EOL."\t".$tab."\t\$this->_item[\$pk] = \$data;";
|
$getItem .= PHP_EOL."\t".$tab."\t\$this->_item[\$pk] = \$data;";
|
||||||
}
|
}
|
||||||
return $getItem;
|
// check if the dispather should be added
|
||||||
|
return str_replace(array_keys($this->JEventDispatcher), array_values($this->JEventDispatcher), $getItem);
|
||||||
}
|
}
|
||||||
return PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)."add your custom code here.";
|
return PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)."add your custom code here.";
|
||||||
}
|
}
|
||||||
@ -2531,6 +2538,8 @@ class Interpretation extends Fields
|
|||||||
$methods .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." check if there was data returned";
|
$methods .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." check if there was data returned";
|
||||||
$methods .= PHP_EOL."\t\tif (\$db->getNumRows())";
|
$methods .= PHP_EOL."\t\tif (\$db->getNumRows())";
|
||||||
$methods .= PHP_EOL."\t\t{";
|
$methods .= PHP_EOL."\t\t{";
|
||||||
|
// set dispatcher placeholder
|
||||||
|
$methods .= "###DISPATCHER###";
|
||||||
// set decoding of needed fields
|
// set decoding of needed fields
|
||||||
if (isset($this->siteFieldData['decode'][$default['code']][$get['key']][$default['as']]))
|
if (isset($this->siteFieldData['decode'][$default['code']][$get['key']][$default['as']]))
|
||||||
{
|
{
|
||||||
@ -2637,10 +2646,12 @@ class Interpretation extends Fields
|
|||||||
$methods = str_replace('###CRYPT###', $script, $methods);
|
$methods = str_replace('###CRYPT###', $script, $methods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// insure the crypt placeholder is removed
|
||||||
$methods = str_replace('###CRYPT###','',$methods);
|
$methods = str_replace('###CRYPT###','',$methods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $methods.PHP_EOL;
|
// check if the dispatcher must be set
|
||||||
|
return str_replace(array_keys($this->JEventDispatcher), array_values($this->JEventDispatcher), $methods).PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCustomViewMethodDefaults($get,$code)
|
public function setCustomViewMethodDefaults($get,$code)
|
||||||
@ -2739,6 +2750,7 @@ class Interpretation extends Fields
|
|||||||
$getItem .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Convert the parameter fields into objects.";
|
$getItem .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Convert the parameter fields into objects.";
|
||||||
$getItem .= PHP_EOL."\t\tif (".$Component."Helper::checkArray(\$items))";
|
$getItem .= PHP_EOL."\t\tif (".$Component."Helper::checkArray(\$items))";
|
||||||
$getItem .= PHP_EOL."\t\t{";
|
$getItem .= PHP_EOL."\t\t{";
|
||||||
|
$getItem .= "###DISPATCHER###";
|
||||||
$getItem .= PHP_EOL."\t\t\tforeach (\$items as \$nr => &\$item)";
|
$getItem .= PHP_EOL."\t\t\tforeach (\$items as \$nr => &\$item)";
|
||||||
$getItem .= PHP_EOL."\t\t\t{";
|
$getItem .= PHP_EOL."\t\t\t{";
|
||||||
$getItem .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Always create a slug for sef URL's";
|
$getItem .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Always create a slug for sef URL's";
|
||||||
@ -2778,6 +2790,8 @@ class Interpretation extends Fields
|
|||||||
$asBucket[] = $main_get['as'];
|
$asBucket[] = $main_get['as'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// check if we should load the dispatcher
|
||||||
|
$getItem = str_replace(array_keys($this->JEventDispatcher), array_values($this->JEventDispatcher), $getItem);
|
||||||
// setup Globals
|
// setup Globals
|
||||||
$getItem .= $this->setCustomViewGlobals($get->global,'$item',$asBucket,"\t\t");
|
$getItem .= $this->setCustomViewGlobals($get->global,'$item',$asBucket,"\t\t");
|
||||||
// setup the custom gets that returns multipal values
|
// setup the custom gets that returns multipal values
|
||||||
|
Loading…
Reference in New Issue
Block a user