Klenkes Posted November 14, 2023 Share Posted November 14, 2023 (edited) I tried to put some default settings in ready.php, like shown in the docs. When editing a block I get a Fatal Error: Uncaught TypeError: ProcessWire::{closure}(): Argument #1 ($settings) must be of type BlockSettingsArray, RockPageBuilder\BlockSettingsArray given in... The part of the ready.php $rpb = $this->wire->modules->get('RockPageBuilder'); $rpb->defaultSettings( function (BlockSettingsArray $settings, RockFieldsField $field, Block $block) { $settings->add([ 'name' => 'bg', 'label' => 'Hintergrund', 'value' => $field->input('bg', 'select', [ '1' => 'Hellgrau', '2' => 'Mittelgrau', '3' => 'Dunkelgrau', '4' => 'Farbe', '5' => 'Nur Trennzeile oben', '6' => 'Nur Trennzeile unten', '7' => 'Trennzeile oben + unten', '10' => 'Foto als Hintergrund', ]), ]); }); Full stack trace: Spoiler Fatal Error: Uncaught TypeError: ProcessWire::{closure}(): Argument #1 ($settings) must be of type BlockSettingsArray, RockPageBuilder\BlockSettingsArray given in D:\Projekte\kopfleere\processwire-rock\www\site\ready.php:50 #0 D:\Projekte\kopfleere\processwire-rock\www\site\modules\RockPageBuilder\RockPageBuilder.module.php(715): ProcessWire->{closure}(Object(RockPageBuilder\BlockSettingsArray), Object(RockFieldsField), Object(RockPageBuilderBlock\Text2Fach)) #1 D:\Projekte\kopfleere\processwire-rock\www\site\modules\RockPageBuilder\RockPageBuilder.module.php(715): Closure->__invoke(Object(RockPageBuilder\BlockSettingsArray), Object(RockFieldsField), Object(RockPageBuilderBlock\Text2Fach)) #2 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(419): RockPageBuilder->___cloneBlockSettings(Object(RockFieldsField), Object(RockPageBuilderBlock\Text2Fach)) #3 D:\Projekte\kopfleere\processwire-rock\www\wire\core\WireHooks.php(968): Wire->_callMethod('___cloneBlockSe...', Array) #4 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(484): WireHooks->runHooks(Object(RockPageBuilder), 'cloneBlockSetti...', Array) #5 D:\Projekte\kopfleere\processwire-rock\www\site\modules\RockPageBuilder\Block.php(317): Wire->__call('cloneBlockSetti...', Array) #6 D:\Projekte\kopfleere\processwire-rock\www\site\templates\RockPageBuilder\blocks\Text2Fach\Text2Fach.php(194): RockPageBuilder\Block->getDefaultSettings(Object(RockFieldsField)) #7 D:\Projekte\kopfleere\processwire-rock\www\site\modules\RockPageBuilder\RockFields.module.php(170): RockPageBuilderBlock\Text2Fach->settingsTable(Object(RockFieldsField)) #8 D:\Projekte\kopfleere\processwire-rock\www\site\modules\RockPageBuilder\Block.php(213): RockFields->getInputfield(Object(RockPageBuilderBlock\Text2Fach), 'rockpagebuilder...', true) #9 D:\Projekte\kopfleere\processwire-rock\www\site\modules\RockPageBuilder\Block.php(902): RockPageBuilder\Block->addSettingsFieldToForm(Object(InputfieldWrapper)) #10 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(416): RockPageBuilder\Block->prepareForm(Object(InputfieldWrapper)) #11 D:\Projekte\kopfleere\processwire-rock\www\wire\core\WireHooks.php(968): Wire->_callMethod('prepareForm', Array) #12 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(484): WireHooks->runHooks(Object(RockPageBuilderBlock\Text2Fach), 'prepareForm', Array) #13 D:\Projekte\kopfleere\processwire-rock\www\site\modules\RockPageBuilder\RockPageBuilder.module.php(656): Wire->__call('prepareForm', Array) #14 D:\Projekte\kopfleere\processwire-rock\www\wire\core\WireHooks.php(1094): RockPageBuilder->buildBlockForm(Object(HookEvent)) #15 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(484): WireHooks->runHooks(Object(ProcessPageEdit), 'buildFormConten...', Array) #16 D:\Projekte\kopfleere\processwire-rock\www\wire\modules\Process\ProcessPageEdit\ProcessPageEdit.module(931): Wire->__call('buildFormConten...', Array) #17 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(416): ProcessPageEdit->___buildForm(Object(InputfieldForm)) #18 D:\Projekte\kopfleere\processwire-rock\www\wire\core\WireHooks.php(968): Wire->_callMethod('___buildForm', Array) #19 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(484): WireHooks->runHooks(Object(ProcessPageEdit), 'buildForm', Array) #20 D:\Projekte\kopfleere\processwire-rock\www\wire\modules\Process\ProcessPageEdit\ProcessPageEdit.module(561): Wire->__call('buildForm', Array) #21 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(413): ProcessPageEdit->___execute() #22 D:\Projekte\kopfleere\processwire-rock\www\wire\core\WireHooks.php(968): Wire->_callMethod('___execute', Array) #23 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(484): WireHooks->runHooks(Object(ProcessPageEdit), 'execute', Array) #24 D:\Projekte\kopfleere\processwire-rock\www\wire\core\ProcessController.php(361): Wire->__call('execute', Array) #25 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(413): ProcessController->___execute() #26 D:\Projekte\kopfleere\processwire-rock\www\wire\core\WireHooks.php(968): Wire->_callMethod('___execute', Array) #27 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(484): WireHooks->runHooks(Object(ProcessController), 'execute', Array) #28 D:\Projekte\kopfleere\processwire-rock\www\wire\core\admin.php(160): Wire->__call('execute', Array) #29 D:\Projekte\kopfleere\processwire-rock\www\site\templates\admin.php(15): require('D:\\Projekte\\kop...') #30 D:\Projekte\kopfleere\processwire-rock\www\wire\core\TemplateFile.php(328): require('D:\\Projekte\\kop...') #31 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(413): TemplateFile->___render() #32 D:\Projekte\kopfleere\processwire-rock\www\wire\core\WireHooks.php(968): Wire->_callMethod('___render', Array) #33 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(484): WireHooks->runHooks(Object(TemplateFile), 'render', Array) #34 D:\Projekte\kopfleere\processwire-rock\www\wire\modules\PageRender.module(575): Wire->__call('render', Array) #35 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(416): PageRender->___renderPage(Object(HookEvent)) #36 D:\Projekte\kopfleere\processwire-rock\www\wire\core\WireHooks.php(968): Wire->_callMethod('___renderPage', Array) #37 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(484): WireHooks->runHooks(Object(PageRender), 'renderPage', Array) #38 D:\Projekte\kopfleere\processwire-rock\www\wire\core\WireHooks.php(1094): Wire->__call('renderPage', Array) #39 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(484): WireHooks->runHooks(Object(Page), 'render', Array) #40 D:\Projekte\kopfleere\processwire-rock\www\wire\modules\Process\ProcessPageView.module(184): Wire->__call('render', Array) #41 D:\Projekte\kopfleere\processwire-rock\www\wire\modules\Process\ProcessPageView.module(114): ProcessPageView->renderPage(Object(Page), Object(PagesRequest)) #42 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(416): ProcessPageView->___execute(true) #43 D:\Projekte\kopfleere\processwire-rock\www\wire\core\WireHooks.php(968): Wire->_callMethod('___execute', Array) #44 D:\Projekte\kopfleere\processwire-rock\www\wire\core\Wire.php(484): WireHooks->runHooks(Object(ProcessPageView), 'execute', Array) #45 D:\Projekte\kopfleere\processwire-rock\www\index.php(55): Wire->__call('execute', Array) #46 {main} thrown (line 50 of D:\Projekte\kopfleere\processwire-rock\www\site\ready.php) This error message was shown because: you are logged in as a Superuser. Error has been logged. PW 3.0.226 RPB 4.7.0 PHP 8.2 Edited November 29, 2023 by Klenkes Problem solved Link to comment Share on other sites More sharing options...
bernhard Posted November 14, 2023 Share Posted November 14, 2023 That's a namespace issue. Your IDE should tell you that. Just add this on top of your ready.php file: use RockPageBuilder\Block; use RockPageBuilder\BlockSettingsArray; I've updated the docs ? Thx 1 Link to comment Share on other sites More sharing options...
Klenkes Posted November 14, 2023 Author Share Posted November 14, 2023 Thanks for the quick answer. No IDE. I am old, and too old for that ? Works now! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now