Search the Community
Showing results for tags 'inputfieldpagelistselectmultiple'.
-
I am trying to create an input field type InputfieldPageListSelectMultiple in a module, but for some reason, it doesn't quite work as expected... (abbreviated) code: $this->addHookAfter('ProcessPageLister::renderResults', function ($event) { $out = ''; if(wire('page')->id === 1224) { // the particular Lister instance page id $form = wire('modules')->get("InputfieldForm"); $field = wire('modules')->get("InputfieldPageListSelectMultiple"); $field->attr('name+id', 'current_selection'); $field->attr('class', 'InputfieldAsmSelect'); $field->label = 'Your current selection'; $field->derefAsPage = FieldtypePage::derefAsPageOrNullPage; // this part works - $total is taken from a session variable if($total) { $sel = $total["selector"]; $myPages = wire('pages')->findIDs($sel); foreach($myPages as $k=>$v) { $field->attr('value', $v, wire('pages')->get($v)->title); } } $form->append($field); $myForm = $form->render(); $event->return = $myForm; } }); What I get is this: I can't drag and drop, the layout is not correct (trashcan should be on the right), and I also can't delete. Furthermore, I see a textinput with the page IDs underneath. Why? Oh, and also: the first item is "Label" o_O I've googled, and looked at Ryan's code, but I guess I'm missing important stuff. (if you're wondering: I'm trying to do a little proof of concept that would (partly) solve this question here)