diff --git a/boot.php b/boot.php index 5c58246..5b4e290 100644 --- a/boot.php +++ b/boot.php @@ -9,30 +9,27 @@ * file that was distributed with this source code. */ -if (rex::isBackend() && rex::getUser()) { - $providers = \Watson\Foundation\Watson::loadProviders(); +if (rex::isBackend() && rex::getUser() && \Watson\Foundation\Watson::hasProviders()) { + if (rex_get('watson_query')) { + $providers = \Watson\Foundation\Watson::loadProviders(); - if (count($providers)) { $workflows = []; - foreach ($providers as $provider) { if ($provider instanceof \Watson\Foundation\Workflow) { $workflows[] = $provider; } } - if (count($workflows)) { - rex_extension::register('PAGE_HEADER', '\Watson\Foundation\Extension::head'); + rex_extension::register('PACKAGES_INCLUDED', '\Watson\Foundation\Extension::run', rex_extension::LATE, ['workflows' => $workflows]); + rex_extension::register('PACKAGES_INCLUDED', '\Watson\Foundation\Extension::callWatsonFunc', rex_extension::LATE); + } - rex_extension::register('OUTPUT_FILTER', '\Watson\Foundation\Extension::agent'); + rex_extension::register('PAGE_HEADER', '\Watson\Foundation\Extension::head'); - rex_extension::register('PACKAGES_INCLUDED', '\Watson\Foundation\Extension::run', rex_extension::LATE, ['workflows' => $workflows]); - rex_extension::register('PACKAGES_INCLUDED', '\Watson\Foundation\Extension::callWatsonFunc', rex_extension::LATE); + rex_extension::register('OUTPUT_FILTER', '\Watson\Foundation\Extension::agent'); - if (\Watson\Foundation\Watson::getToggleButtonStatus()) { - rex_extension::register('META_NAVI', '\Watson\Foundation\Extension::toggleButton'); - } - } + if (\Watson\Foundation\Watson::getToggleButtonStatus()) { + rex_extension::register('META_NAVI', '\Watson\Foundation\Extension::toggleButton'); } foreach ($this->getProperty('stylesheets', []) as $stylesheet) { diff --git a/lib/Watson/Foundation/Watson.php b/lib/Watson/Foundation/Watson.php index 0820037..220cbb4 100644 --- a/lib/Watson/Foundation/Watson.php +++ b/lib/Watson/Foundation/Watson.php @@ -72,6 +72,13 @@ public static function translate($key, ...$params) { return \rex_i18n::msg($key, ...$params); } + + public static function hasProviders() { + $providers = \rex_addon::get('watson')->getProperty('providers'); + $providers = \rex_extension::registerPoint(new \rex_extension_point('WATSON_PROVIDER', $providers)); + + return count($providers) > 0; + } public static function loadProviders() {