Mackski

Members
  • Content Count

    133
  • Joined

  • Last visited

Community Reputation

26 Excellent

About Mackski

  • Rank
    Sr. Member

Recent Profile Visitors

2,931 profile views
  1. I have a strange problem with repeaters, the markup for sort order is rendered correctly, as is the repeater list and markup: eg: <input id="sort_repeater73338" class="InputfieldRepeaterSort" name="sort_repeater73338" value="0" type="hidden"> <input id="sort_repeater73322" class="InputfieldRepeaterSort" name="sort_repeater73322" value="1" type="hidden"> After saving, there is no change in the sort order in the DB. Every repeater with the same parent has the same sort order, no matter what. This happens at the time of created via the API, I am explicitly setting the sort order here: $rep = $p->draw_nomination_repeater->getNew(); $rep->page_link = $array['id']; $rep->sort = $x++; $p->draw_nomination_repeater->add($rep); $p->of(false); $p->save(); Could the sort change not be detected when creating multiple repeaters via the API? if($page->isChanged('sort')) { // $this->message("Sort changed for field {$this->field} page {$page->id}", Notice::debug); $sortChanged = true; }
  2. Hands up for beta testing! Looks outstanding!
  3. Mackski

    Thanks for your help @Zeka I managed to get both hooks working after a bit of debugging. $this->addHookAfter("ProcessField::buildEditFormBasics", function(HookEvent $event) { $f = $event->object->getField(); if($f->hasFieldtype !== false) { $field = wire('modules')->get('InputfieldTextarea'); $field->attr('name', 'helpTipContent'); $field->attr('value', $f->helpTipContent); $field->collapsed = $f->helpTipContent ? false : true; $field->label = __('Help tip content'); $field->description = __('Enter the help tip content that will appear in the tool tip.'); $event->return->append($field); } }); // inject our markup fields into the form right after the source elements $this->addHookAfter('ProcessPageEdit::buildForm', function($event) { $form = $event->return; $page = $this->process->getPage(); foreach($form->fields as $f) { $content = $f->helpTipContent; if($content) { $_field = $form->get($f->name); if($_field->id) { // add hidden field with tooltip content $field = wire('modules')->get('InputfieldMarkup'); $field->attr('name', 'toolTipContent'); $field->attr('value', $content); $field->skipLabel = true; $form->insertAfter($field, $_field); } } } });
  4. Mackski

    I've modified the hooks to add the field to every inputField. // first hook to add field (works as expected) $this->addHookAfter("ProcessField::buildEditFormBasics", function(HookEvent $event) { $f = $event->object->getField(); if($f->hasFieldtype !== false) { $field = wire('modules')->get('InputfieldTextarea'); $field->attr('name', 'helpTipContent'); $field->attr('value', $f->helpTipContent); $field->collapsed = $f->helpTipContent ? false : true; $field->label = __('Help tip content'); $field->description = __('Enter the help tip content that will appear in the tool tip.'); $event->return->append($field); } }); // second hook to render $this->addHookBefore("Inputfield::renderReadyHook", function($event) I still cant find the helpTipContent field in the second method, maybe I'm hooking into the wrong place?
  5. Mackski

    @ZekaDefiantly not working for me, im stumped now.
  6. Mackski

    Thanks Zeka, my next issue is I've created a custom textarea against a field, and value is saved, but I cannot return the value at render time. I've been modeling a bit of code from: https://processwire.com/talk/topic/9857-page-field-edit-links/ I cannot seem to replicate the rendering of saved values, here is my code: // this works, and saves values against a custom field $this->addHookAfter("InputfieldPage::getConfigInputfields", function($event) { $f = $event->object; if($f->hasFieldtype !== false) { $field = wire('modules')->get('InputfieldTextarea'); $field->attr('name', 'helpTipContent'); $field->attr('value', $f->helpTipContent); $field->collapsed = $f->helpTipContent ? false : true; $field->label = __('Help tip content'); $field->description = __('Enter the help tip content that will appear in the tool tip.'); $event->return->append($field); } }); // at render time $this->addHookAfter("InputfieldPage::renderReadyHook", function($event) { $object = $event->object; d($object); }); // $object does not include my new field, helpTipContent.
  7. Struggling with this, trying to obtain a list of fields under a specific tab in admin. $this->addHookAfter("ProcessPageEdit::buildForm", $this, 'hookField'); public function hookField(HookEvent $event) { $form = $event->return; $fieldset = $form->find("id=ProcessPageEditContent"); $fields = $fieldset->fields; foreach($fields as $f) { echo $f->name.'<BR>'; } } This only outputs all fields from all templates, not the fields from the specific page & table I'm editing.
  8. If I'm adding a custom field I also take it that I'll need to create a schema etc to store the values? Is there a way to adding abitry fields to a page in admin similar to notes, description fields without defining a schema?
  9. Mackski

    Thanks Benhard for this module, small modification i've updated the save() function to allow various output types as stated: https://mpdf.github.io/reference/mpdf-functions/output.html /* ########## output ########## */ /** * save output to: local file ($dest = "FILE") download ($dest = "DOWNLOAD") inline to browser (default - $dest = "INLINE") */ public function save($filename = 'output.pdf', $dest = "INLINE") { if(!$filename) $filename = 'output.pdf'; if($dest == "FILE") $filename = $this->getAbsolute($filename); // save to disk $this->mpdf->Output($filename, constant('\Mpdf\Output\Destination::'.$dest)); } // stream to browser $pdf->save(); $pdf->save('filename.pdf') $pdf->save('filename.pdf,'INLINE); // force download $pdf->save('myfile.pdf','DOWNLOAD'); // save locally $pdf->save('myfileserver.pdf','FILE');
  10. Mackski

    I have a custom admin page & process setup, i want to display an edit page from the page tree.The template contains a PageTable to manage child entries.How would i render this as a stand alone page within my custom process?
  11. Mackski

    In addition to this, I have repeaters with a page field reference. And only 1 in the repeater array does not provide a valid ID. This is super weird, because it's always worked until now. eg: for($page->dad_repeater as $r) { $ref = $r->child_page_ref; if(!$ref->id) die("Error, invalid page reference for repeater ".$r->id); } My code dies on this error, with a valid repeater id. When I check that repeater ID in Processwire, it has valid child_page_ref. Why will the child_page_ref->id return null when the child_page_ref is published, and selected in PW. * FIXED * Underlying code was setting the ID to -1
  12. repeater->sort is returned with duplicate values for multiple entries, not sure how this can even happen. Has anyone experienced this before? I now have to set an index++ while looping though my repeater to set the sort order
  13. Tracey doesnt show the full query?
  14. I've enabled $config->debug = true; however $database->getQueryLog() returns an empty array. Does this need to be supported by mysql settings in any way?
  15. Mackski

    100% not working. I've tried a normal textarea field, same result, on save ALL HTML is stripped out. ProcessWire 2.8.62