-
Posts
267 -
Joined
-
Last visited
Profile Information
-
Location
Kent, UK
Recent Profile Visitors
3,416 profile views
JayGee's Achievements
Sr. Member (5/6)
147
Reputation
-
This is fantastic thank you 🙏. Building this exact integration for ProcessWire has been on our backlog a while - excited to give it a try.
-
Ah ok perfect thanks - that explains it - I still need to add the form styles. 😎 Thanks for the module and keep up the good work!
- 25 replies
-
- forms
- formbuilder
-
(and 2 more)
Tagged with:
-
I've had a moment to check now and can confirm the upgrade solves the issue and conditional fields now work. Although I'm seeing a slightly different issue - some of my styling on the form changes when using your render()method. At a glance I can't quite put my finger on what changes in the output to cause this - I think it could be to do with where in the page the scripts etc are injected vs. manually putting them into the template rather than a bug. Which embed method does your module use for the form render? (Sorry for the vague feedback!... up against a deadline and happy to test more for you later if it would be useful. 🙂) Great module though - super useful addition!
- 25 replies
-
- 1
-
- forms
- formbuilder
-
(and 2 more)
Tagged with:
-
Amazing thanks - will give that a test shortly and confirm back.
- 25 replies
-
- 1
-
- forms
- formbuilder
-
(and 2 more)
Tagged with:
-
Hi @FireWire - Great module thanks. Using it in Repeater Matrix too and it is working great so far. One issue - I don't think it's working with conditional fields (required only if, visible only if)... maybe a know issue or still on the roadmap though?
- 25 replies
-
- 1
-
- forms
- formbuilder
-
(and 2 more)
Tagged with:
-
I would like to second the votes for greater developer tooling. Things like: Being able to re-use the same field in a template. Being able to more easily and natively version control template/field definitions. Perhaps definition of template fields from inside the template code itself or page class? Perhaps better support of raw html in template views vs. php files - maybe through an enhanced JS api for field content, or using data-attributes directly in html. This would smooth development pathways from front-end design/dev to backend with less reliance on local/dev php servers and more 'headless' functionality. (Obviously not a major hangup, but just a slight modernisation).
-
How to hook repeater or repeater matrix field output
JayGee replied to JayGee's topic in Module/Plugin Development
SOLVED - but I'll leave this here for anyone else to reference as I struggled to find examples. Long story short, I think I was massively overthinking it - with a bit of help from Chat GPT (!! Chat GPT know ProcessWire now - who knew!) I've got this: ..... } elseif($field->type == 'FieldtypeRepeaterMatrix') { //HANDLE REPEATERS HERE $repeaterItems = $page->$field; foreach ($repeaterItems as $item) { // Iterate over each field in the Repeater Matrix item foreach ($item->fields as $subField) { $subFieldName = $subField->name; $subFieldValue = $item->get($subFieldName); // Perform your modification here if the subfield is a string type if (is_string($subFieldValue)) { $modifiedValue = $this->replace_merge_tags($subFieldValue, $tags, $defaultTags); // Save the modified content back to the item $item->set($subFieldName, $modifiedValue); } } } }- 1 reply
-
- 2
-
I've got some code that is carrying out a basic find-and-replace operation on some page output. I'm hooking into the page render: $this->addHookBefore('Page::render', $this, 'renderOutput'); Looping through the fields and modifying page output accordingly which is all working fine. The problem is I cannot figure out what approach I should be using for doing the same on repeater or repeater matrix fields in the page output. As far as I can tell Page::render hook doesn't fire for the repeater pages so I presume I need to loop through the matrix item sub fields at output. Does anyone have any guidance/examples - I can only find examples for hooking repeaters on CMS side rather than frontend output.
-
Thanks @BitPoet - exactly what I was looking for. ?
-
DW - Found it ?♂️ Had to add some logic to detect if we're already on the 404 page as my array check was broken because the data isn't present on the 404 (created a loop). if (array_key_exists($this->input->urlSegment1,$allVariantData)) I'm now doing if($page->id != 27) { //Wrap in condition to ensure this logic doesn't affect 404 pages is this the best way to detect a 404 page? Does the 404 ID ever change, or is this solid enough to rely on?
-
I have an autoload module with the follow (abridged) code. The problem is that I cannot seem to throw the 404 error below. There's no page output prior to this point, so I can't see why this isn't working. Hoping someone else can! Hook via init() <?php public function init() { $this->addHookBefore('Page::render', $this, 'renderOutput'); } my function: <?php public function renderOutput($event) { $variant = 'defaults'; if ($this->input->urlSegment1) { if (array_key_exists($this->input->urlSegment1,$allVariantData)) { $variant = $this->input->urlSegment1; } else { throw new Wire404Exception(); //throw 404 to prevent made up variants resolving dynamic default data for 'pages' that don't exist } } } I've taken out the code not relevant to the issue but can confirm all the other logic and that around the url segments is all running as expected. I just get an exception when I try to call the 404 exception!
-
It would be cool to try and get something up and running. I think there's a growing awareness of PW and we pick up a few but ever increasing number of organic enquiries from people who have PW sites built for them by other people so it only seems natural they would check the PW website to find devs.
-
JayGee started following Best way to find non admin templates?
-
On second thoughts - hasparent is a page selector isn't it rather than a template selector? EDIT: Can confirm this works perfectly for my scenario - thanks for your help @wbmnfktr and @Robin S: $templates = $this->templates->find("flags=0"); Now I know of the existence of the template flag system this is really handy. For reference for anyone readying this in the future, checking the database I can see the standard templates all have flag 0 as implemented above. The admin repeater templates are all flag 8.
-
Thanks both, this all makes sense - I knew there would be a way I was overlooking! I think in all likelihood I'll use a combination of the 2 suggested selectors as there's no reason for me to touch anything in the admin folder: $non_system_templates = $templates->find("flags=0,!hasParent=2"); I need to make sure I also exclude repeater templates. The reason this issue came up is because I'm adding a repeater field, and it got added to the repeater templates which caused an infinite loop when adding a repeater item! ?♂️
-
This feels like it should be simple but can't see it in the API docs. I want to loop through all a site's templates and add some fields via a module, but I don't want to touch admin templates. What's the best way to filter them? Is there a selector for $templates->find() like admin=false or similar?