-
Posts
140 -
Joined
-
Last visited
Recent Profile Visitors
4,320 profile views
Mackski's Achievements
-
Mackski started following how to create non editable field to show page ID in admin form? , Autocomplete field reset via JS , Moving repeater items from one page to another and 5 others
-
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?
-
Just installed the module with a fresh PW install and have a fatal error: $menu = $this->modules->get('MarkupMenuBuilder'); $this->navigation = $menu->render('main');
-
Moving repeater items from one page to another
Mackski replied to Mackski's topic in API & Templates
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); -
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?
-
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!!
-
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;
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
Mackski replied to kongondo's topic in Modules/Plugins
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']; -
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; }
-
Designme - Visually Layout Your Edit Screens - Preview
Mackski replied to joshuag's topic in Modules/Plugins
Hands up for beta testing! Looks outstanding! -
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); } } } });
-
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?
-
-
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.
-
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.
-
how to create non editable field to show page ID in admin form?
Mackski replied to neosin's topic in Getting Started
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?