Aah, I see. That's a cool usage of the module you got there! . Using wireRenderFile() keeps the module's input clean, circumvents limit of text allowed in that field plus makes the module much more versatile. One can do all sorts of flexible includes from within the file rendered by wireRenderFile(), depending on the context. I have tested and it works fine here creating a new page (see below). Cloning a page on the other hand leads to a cyclical error (or memory issue) and crashes Apache.  In details tab of this module I have: return wireRenderFile('test'); In /site/templates/test.php $out =''; $f = $modules->get("InputfieldText"); $f->label = "Copy Title";// @note: doesn't seem to work $f->attr('id+name','name'); $f->required = 1;// @note: -ditto- $out= $f->render(); // append the field to the form // oh a submit button! $f = $modules->get("InputfieldSubmit"); $f->attr("value","Create Copy"); $f->attr("id+name","createcustomcopy"); $out .= $f->render(); $currentPage = ''; $process = wire('process'); if($process && $process->className() == 'ProcessPageEdit') $currentPage = $process->getPage(); if(!$currentPage) return; echo $out; // let's create a copy $copy = $input->post->createcustomcopy; $title = $sanitizer->text($input->post->name); if($copy) { if(!$title) { $this->error('You need to specify a title for the copied page!'); return; } $p = new Page(); $p->template = $templates->get($currentPage->template); $p->parent = $currentPage->parent; $p->title = $title; //sanitize and convert to a URL friendly page name $p->name = $sanitizer->pageName($p->title); //check if name already taken within same parent. if the same name exist, don't create a new copy // @note; without this line pages were being created in duplicates if($p->parent->child("name={$p->name}, include=all")->id) return; else { $p->save(); $this->message('Created a copy of the page with the title: ' . $title); } }
    • Like