Jump to content

Mackski

Members
  • Posts

    140
  • Joined

  • Last visited

Everything posted by Mackski

  1. I'm using a page reference autocomplete field in a template as a "lookup" then populating other fields via ajax call. I want to reset the autocomplete on success, i've tried a few things but the value still persists.. What i've tried: $('#Inputfield_search).val('') // no effect $('#Inputfield_search).data('selectedlabel',''); // no effect I guess last resort would be to trigger the (X) on the autocomplete input. Is there an easier way to reset this field type via JS?
  2. Just installed the module with a fresh PW install and have a fatal error: $menu = $this->modules->get('MarkupMenuBuilder'); $this->navigation = $menu->render('main');
  3. getForPage() is used on an actual repeater item? The repeater is empty. if i print_r($page->repeater); i can see the page parent in the selectors: parent_id=11686 This is ID is what I'm trying to retrieve. ProcessWire\RepeaterPageArray Object ( [hooks] => Array ( [PageArray::render] => MarkupPageArray->renderPageArray() in MarkupPageArray.module [PageArray::renderPager] => MarkupPageArray->renderPager() in MarkupPageArray.module ) [count] => 0 [total] => 0 [start] => 0 [limit] => 0 [selectors] => parent_id=11686, templates_id=104, sort=sort ) [SOLVED] As simple as: $parent_id = $pages->get('name=for-page'.$page->id);
  4. I'm trying to move repeater items, simply change the parent id of each repeater item but I'm struggling to retrieve the actual ID of the repeater on the target page. (Not the field id, the repeater_page_id) If the repeater on the target page is empty; What i need is: $target_repeater_parent = $target_page->repeater_field->id; So I can: foreach($source_page->repeater_field as $item) { $item->parent = $target_repeater_parent; $item->save(); } What am I missing here?
  5. You're right, It just wasn't obvious at the time, now that I create another menu it's fine, i must have been smoking something.. ?? Thanks for this great module!!
  6. Using this module for the first time, menu created and saved but does not render. Looks like by default it's saved as un-published. I was expecting to find publish settings as part of the menu settings, however the only way to publish it is via the page tree: Admin > Setup > Menu Builder > *Menu* Is this intentional? I think from a usability perspective being able to publish the menu as you create it would be helpful. The only way I could get menu builder to render items was update line 218, MarkupMenuBuilder to: For some unknown reason, PW doesnt skip language. // skip inactive language page @note: PW will do this automatically for 'include_children' if(!$p->viewable($language) && $language) continue;
  7. How do I get a reference to the repeater page, instead of the page the repeater is on? $page->id returns the parent or containing page, rather than the repeater id. [SOLVED] $value = $this->hasPage->data['some_field'];
  8. 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; }
  9. 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); } } } });
  10. 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?
  11. @ZekaDefiantly not working for me, im stumped now.
  12. 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.
  13. 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.
  14. 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?
  15. 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');
  16. 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?
  17. 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 ?
  18. 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
  19. 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?
  20. 100% not working. I've tried a normal textarea field, same result, on save ALL HTML is stripped out. ProcessWire 2.8.62
  21. <br> or <br /> This doesnt seem to be reflected within CK editor. eg: $page->body = $sanitizer->purify("<br />Some Content<br /><br />More Content"); Results in one long string in CK. Bug? Or am I missing something here.
  22. Using the page lister to select some custom fields for reporting purposes, all works as expected until I save the bookmark. This works and returns expected results: Once saved I get an error: Any ideas? Is there a way I can enable subselectors for PageLister?
  23. I'm still having problems with customer selectors to find selectable pages. Specifically when trying to include unpublished pages, my custom selector is: template=horse_profile,include=all This selector only returns published pages, which is driving me nuts!
×
×
  • Create New...