Skip to content

Commit

Permalink
Make view's customScriptsLoaded more robust
Browse files Browse the repository at this point in the history
The prior flag was instance-based and could lead to multiple theme
custom.php loads if multiple instances of Omeka_View were created.
  • Loading branch information
zerocrates committed Oct 30, 2024
1 parent 0c26543 commit 5e4c86b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions application/libraries/Omeka/Test/AppTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ public function reset()
Zend_Controller_Action_HelperBroker::resetHelpers();
$this->frontController->resetInstance();
Zend_Session::$_unitTestEnabled = true;
Omeka_View::$customScriptsLoaded = false;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions application/libraries/Omeka/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Omeka_View extends Zend_View_Abstract
*
* @var bool
*/
private $_customScriptsLoaded = false;
public static $customScriptsLoaded = false;

/**
* @param array $config View configuration.
Expand Down Expand Up @@ -125,7 +125,7 @@ public function _run()
*/
private function _loadCustomThemeScripts()
{
if ($this->_customScriptsLoaded) {
if (self::$customScriptsLoaded) {
return;
}

Expand All @@ -144,7 +144,7 @@ private function _loadCustomThemeScripts()
if ($pluginBroker) {
$pluginBroker->setCurrentPluginDirName($tmpPluginDir);
}
$this->_customScriptsLoaded = true;
self::$customScriptsLoaded = true;
}

/**
Expand Down

0 comments on commit 5e4c86b

Please sign in to comment.