Closed hmsuchier closed 1 year ago
Could you check what the output of this is when added in PartialReader.php
after the last line of the init method after line 116?
dd($this->getPartialsPaths(), $this->byHandle);
Also, if you can post the full stack trace of the error from your system.log that would be great!
Also, please try updating to v2.2.14
. If you are using the multi site feature with a custom theme this error might be caused by a bug in that logic that has been fixed in v2.2.14.
Thanks for your help, here's where I pasted the dd:
...
$this->byHandle->put($config->handle, new Partial($config));
}
dd($this->getPartialsPaths(), $this->byHandle);
$this->byHandle->each(fn (Partial $partial) => $partial->config->processMixins($this->byHandle));
}
And the dumps I got:
array:1 [▼ // plugins/offline/boxes/classes/partial/PartialReader.php:118
0 => "/var/www/site/themes/demo/partials"
]
Illuminate\Support\Collection {#461 ▼ // plugins/offline/boxes/classes/partial/PartialReader.php:118
#items: []
#escapeWhenCastingToString: false
}
I understand that the partial path is not correct: it's the "demo" theme which is actually present in the themes but not active!
for what I can see, $theme = \Cms\Classes\Theme::getActiveTheme();
(l.61 of that same file) does not give the correct answer. So that's rather a problem with October itself that with this plugin.
Thank you for the feedback! This is indeed a tricky issue. We have already tackled this problem in #53 and it has been upstreamed to October (https://github.com/octobercms/october-private/issues/398).
The problem is with the Boxes plugin, October just makes it very hard to determine the active theme as it can be configured using the .env file and overruled by the multisite feature.
Setting the theme in .env
should immediately solve the problem for you. But Boxes should be able to determine the theme by itself.
Did you update to the latest version? Does the problem still persist?
$theme = \Cms\Classes\Theme::getActiveTheme(); (l.61 of that same file) does not give the correct answer
This will be initially wrong but should be set correctly in the Event::listen
calls that follow.
Thanks for your support! I do not see the latest Boxes version available in October backend, should I do the update manually?
You can update the plugin using the following command:
composer update offline/oc-boxes-plugin
Version v2.2.16 is the latest verison that contains a lot of fixes for this problem.
Thanks! It worked by just changing ACTIVE_THEME in .env file without plugin update, but now that I've updated the plugin, I get an error in a popup. Here's the corresponding log:
[2023-05-26 12:29:37] local.ERROR: OFFLINE\Boxes\Classes\Exceptions\PartialNotFoundException: Could not find partial with handle "boxes/soutiens". in /var/www/rev/plugins/offline/boxes/classes/partial/PartialReader.php:134
Stack trace:
#0 /var/www/rev/plugins/offline/boxes/formwidgets/BoxesDataForm.php(41): OFFLINE\Boxes\Classes\Partial\PartialReader->findByHandle('boxes/soutiens')
#1 /var/www/rev/modules/backend/classes/WidgetBase.php(72): OFFLINE\Boxes\FormWidgets\BoxesDataForm->init()
#2 /var/www/rev/modules/backend/classes/FormWidgetBase.php(95): Backend\Classes\WidgetBase->__construct(Object(OFFLINE\Boxes\Controllers\EditorController), Object(stdClass))
#3 /var/www/rev/modules/backend/traits/WidgetMaker.php(86): Backend\Classes\FormWidgetBase->__construct(Object(OFFLINE\Boxes\Controllers\EditorController), Object(Backend\Classes\FormField), Object(stdClass))
#4 /var/www/rev/modules/backend/widgets/form/HasFormWidgets.php(65): Backend\Classes\WidgetBase->makeFormWidget('OFFLINE\\Boxes\\F...', Object(Backend\Classes\FormField), Object(stdClass))
#5 /var/www/rev/modules/backend/widgets/form/FieldProcessor.php(101): Backend\Widgets\Form->makeFormFieldWidget(Object(Backend\Classes\FormField))
#6 /var/www/rev/modules/backend/widgets/Form.php(659): Backend\Widgets\Form->processFormWidgetFields(Array)
#7 /var/www/rev/modules/backend/widgets/Form.php(154): Backend\Widgets\Form->defineFormFields()
#8 /var/www/rev/plugins/offline/boxes/formwidgets/BoxesEditor.php(406): Backend\Widgets\Form->bindToController()
#9 /var/www/rev/plugins/offline/boxes/formwidgets/BoxesEditor.php(80): OFFLINE\Boxes\FormWidgets\BoxesEditor->buildBoxForm(Object(OFFLINE\Boxes\Models\Box))
#10 /var/www/rev/modules/backend/classes/WidgetBase.php(72): OFFLINE\Boxes\FormWidgets\BoxesEditor->init()
#11 /var/www/rev/modules/backend/classes/FormWidgetBase.php(95): Backend\Classes\WidgetBase->__construct(Object(OFFLINE\Boxes\Controllers\EditorController), Object(stdClass))
#12 /var/www/rev/modules/backend/traits/WidgetMaker.php(86): Backend\Classes\FormWidgetBase->__construct(Object(OFFLINE\Boxes\Controllers\EditorController), Object(Backend\Classes\FormField), Object(stdClass))
#13 /var/www/rev/plugins/offline/boxes/controllers/EditorController.php(38): OFFLINE\Boxes\Controllers\EditorController->makeFormWidget('OFFLINE\\Boxes\\F...', Array, Object(stdClass))
#14 /var/www/rev/modules/system/traits/DependencyMaker.php(29): OFFLINE\Boxes\Controllers\EditorController->index()
#15 /var/www/rev/modules/backend/classes/Controller.php(383): Backend\Classes\Controller->makeCallMethod(Object(OFFLINE\Boxes\Controllers\EditorController), 'index', Array)
#16 /var/www/rev/modules/backend/classes/Controller.php(356): Backend\Classes\Controller->execPageAction('index', Array)
#17 /var/www/rev/modules/backend/classes/Controller.php(445): Backend\Classes\Controller->pageAction()
#18 /var/www/rev/modules/backend/classes/Controller.php(256): Backend\Classes\Controller->execAjaxHandlers()
#19 /var/www/rev/modules/backend/classes/BackendController.php(118): Backend\Classes\Controller->run('index', Array)
#20 /var/www/rev/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): Backend\Classes\BackendController->run('offline/boxes/e...')
#21 /var/www/rev/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\Routing\Controller->callAction('run', Array)
#22 /var/www/rev/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Backend\Classes\BackendController), 'run')
#23 /var/www/rev/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\Routing\Route->runController()
#24 /var/www/rev/vendor/laravel/framework/src/Illuminate/Routing/Router.php(798): Illuminate\Routing\Route->run()
#25 /var/www/rev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#26 /var/www/rev/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 /var/www/rev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#28 /var/www/rev/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#29 /var/www/rev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#30 /var/www/rev/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 /var/www/rev/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest(Object(Illuminate\Http\Request), Object(Illuminate\Session\Store), Object(Closure))
#32 /var/www/rev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#33 /var/www/rev/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#34 /var/www/rev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 /var/www/rev/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#36 /var/www/rev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#37 /var/www/rev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#38 /var/www/rev/vendor/laravel/framework/src/Illuminate/Routing/Router.php(797): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#39 /var/www/rev/vendor/laravel/framework/src/Illuminate/Routing/Router.php(776): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#40 /var/www/rev/vendor/laravel/framework/src/Illuminate/Routing/Router.php(740): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#41 /var/www/rev/vendor/october/rain/src/Router/CoreRouter.php(32): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#42 /var/www/rev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(190): October\Rain\Router\CoreRouter->dispatch(Object(Illuminate\Http\Request))
#43 /var/www/rev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#44 /var/www/rev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#45 /var/www/rev/vendor/october/rain/src/Foundation/Http/Middleware/CheckForMaintenanceMode.php(23): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 /var/www/rev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#47 /var/www/rev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#48 /var/www/rev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#49 /var/www/rev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(134): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#50 /var/www/rev/index.php(42): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#51 {main}
edit: it seems however that theme path is correctly guessed for what I can see.
Thank you! Let me see if I can reproduce this.
You can downgrade the plugin in the meantime:
composer require offline/oc-boxes-plugin:v2.2.13
Could you give the latest version another try?
composer update offline/oc-boxes-plugin
Just to let you know: all is good with version 2.2.15!
Could you give the latest version another try?
composer update offline/oc-boxes-plugin
Yep, all good with version 2.2.17 as well!
Very well! Thank you for helping me debug the issue. Let me know if you experience any further problems.
Describe the bug With the plugin freshly installed, I just copy/pasted the cards.htm & cards.yaml files in my theme's partials directory. I can see the corresponding box appear in the available boxes list when clicking on "add a box to this page". However when actually clicking on "add box" button, I get a popup with the following error ("cards" is the handle mentioned in the cards.yaml):
"Could not find partial with handle "cards"." on line 142 of /var/www/rev/plugins/offline/boxes/classes/partial/PartialReader.php
Same behavior with the simplest test.htm/test.yaml (with just a handle on it as mentioned in the doc).
Boxes Version v2.2.13
To Reproduce Steps to reproduce the behavior:
Any help appreciated!