-
Posts
1,479 -
Joined
-
Last visited
-
Days Won
21
Everything posted by elabx
-
I think, if you mean the actual pages selected, you have to check for the template permissions of the selectable pages. Field access will show/hide the actual field for different roles.
-
Date field output formatting with strftime() not outputting AM/PM
elabx replied to elabx's topic in General Support
Just tried this with no success, now that you say so, capital letters are not working but they do fallback to the lowercase version. I'm reading that it's kind of a common issue that I'm guessing have to do with the server configuration. I'll have to take a linux dive then. -
The most simple approach I can think of right now is hook into after InputfieldText::render: Put this code in site/ready.php: $wire->addHookAfter("InputfieldText::render", function($event){ $field = $event->object; if($field->name == "text_field_name" && $field->value){ $markup = $event->return; $url = "https://somedomain.com"; $markup .= "<img width='100' src='". $url . $field->value ."'>"; $event->return = $markup; } }); I'm assuming $url is whatever you need to append to complete the url with the ID in place. This should render the image right below the text input. If you want to dig a bit more, check the code in the link I pasted and debug with a $log->save() the $markup variable which basically gets it's content from the $event->return property which matches the return value of the render function in the Inpufield code.
-
Hi everyone! I have a datefield I want to output in spanish in a lister but when I configure the time such as this: %b %e %a %l:%M%P I just can't get the AM/PM part of it to output ?. If i just use the dropdowns for date() formats, it works just fine. Spanish locale seems to be setup correctly because everything else language-wise works well. Has anyone came accros this issue?
-
The field has an option for a default value though it will only apply to newly created pages (in case you have previously created some of them). My bad, this does not exist haha, I think only integer has this. But you could certainly do this with an "after hook" on ProcessPageEdit::buildForm and edit the value of the field in question. I dont have an immediate example but there is probably some around the forum
-
I don't think this is possible right now with Ryan's code.
- 1 reply
-
- 1
-
-
OHHH you know what, I'm plain wrong. The problem with processPageEdit is that it redirects on init if there is no page id in the query parameters, so unless you add that parameter to your request, it will always redirect. https://github.com/processwire/processwire/blob/master/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module#L358 Also its hould be preceded by the word execute, and camelcase the method name. What I had ACTUALLY done, is hook right before page edit and just halt execution when I'm done with my stuff, but surely this doesn't feel really clean. https://github.com/elabx/InputfieldExportFiles/blob/master/InputfieldExportFiles.module#L30
-
Something I have done is add a method through a hook such as: $wire->addHook("ProcessPageEdit::executeCustomModule", function(){ ... }) So then you can make a request to: page/edit/custom-module
-
Hi! Small request here, just added Input Mask to integer fields tweaking a little bit of lines in the module, maybe this should be enabled by default? Anyone see any possible issues, maybe on number type inputs? I think it's the type of field where it is particularly useful so you can filter nicely with selectors. (think of a price field)
-
Better way to check for minimum count if($total > 3)
elabx replied to hollyvalero's topic in General Support
Yes sorry! Jumped ahead too fast! Now I am in intrigued too ? Could you throws us a lead @jens.martsch ? Like, I cannot find PaginatedArray or PageArray classes to have their own implementation of count. -
Better way to check for minimum count if($total > 3)
elabx replied to hollyvalero's topic in General Support
What's happening is that integer 0 loosely evaluates to false and any value 1+ evaulates to true: https://www.php.net/manual/es/types.comparisons.php#types.comparisions-loose -
Better way to check for minimum count if($total > 3)
elabx replied to hollyvalero's topic in General Support
It's a debug command from Tracy Debugger module. -
Maybe here?? https://github.com/processwire/processwire/blob/master/wire/core/Pagefiles.php#L409
-
If any of the alternatives work I'd still wonder why his original code wouldn't work.
-
The real MVPs!!
-
Save page in PageTable field before close event on Add New modal.
elabx replied to elabx's topic in General Support
Thanks, definitely overdid it there ? -
Save page in PageTable field before close event on Add New modal.
elabx replied to elabx's topic in General Support
Thanks for your answer Robin! Your solution is one of the paths i might take. And thanks for those links! Which basically lead to a solution by Soma saving info in the session variable. Another Idea I haver is to add a url param to the Add New button (also mentioned in a github issue by @Macrura), to have information about the page within the modal, and maybe that way, I would just need a hook on Page::added and getting the "pagetable field owner" through a input->get->owner_field. What's your opinion on this? I'm not entirely STUCK on pagetables, but I like better the way they render (RM is too bulky) and also seems more straightforward to bring as pages to display on another lister. (tho I know i could do this with repeater pages too, just doesn't seemed to me like the best way to go about it). EDIT: I have something like this working now: (credits to @Macrura who also posted a similar idea in a github issue, so gave it a shot): EDIT2: Simplified hook for pagetable add new button markup edit. Thanks @Robin S! $wire->addHookAfter('InputfieldPageTable::render', function ($event) { if($event->object->name == "asignaciones"){ $markup = $event->return; $markup = str_replace("&context=PageTable", "&context=PageTable&field_parent={$event->object->hasPage}", $markup); $event->return = $markup; } }); wire()->addHookAfter('Pages::added', function($event) { $page = $event->arguments(0); if($page->template == "asignacion"){ if($this->input->get->field_parent){ $owner = $this->pages->get($this->input->get->field_parent); if($owner->id){ $owner->of(false); $owner->asignaciones->add($page); $owner->save('asignaciones'); } } } }); -
What about $cache? I don't think it saves WireArrays but it can handle normal arrays and PageArrays if that works. https://processwire.com/api/ref/wire-cache/save/
-
This might be a repeated topic from one i created a couple days ago but wanted to rephrase it to be more clear. Is there a way to save pages created through the add new button on PageTable field before it is saved/closed? I see in the field's javascript that the page is only added when closing the modal, I do some after save hook work on the page using the modal window that depends on the page being added to the field.
-
Using owner selector to determine if the owner page is published
elabx replied to a-ok's topic in General Support
For what I understand, the owners elector will try to get the pages where the projects_awards is set, not the actual repeater pages, I'm thinking the template selector is what's causing the error because the template repeater_projects_awards doesn't have a projects_awards field. (but my reasoning could be messed up too haha). I'd try something like this maybe, that would give an array with a PageArray in each item, though you might to flatten the array and have all repeater pages in a single array: $awards = $pages->find('template=projects, projects_awards.count>0')->explode('projects_awards'); -
The title sums it up pretty much! I have a page where I save clients information, and then I create an "assignment" where I can pick a sales person and send them an email (through a hook after page::save) about the clients and this assignments page help me keep track of which salespeople have worked with the client. The problem is, when saving through the hook, i look for the client info like this (to send within the email): $pages->find('assignments=$page'); Where $page, is the assignment being created. Maybe I should hook onto a field save? Or save the page beforehand in the same hook? (though i think I don't have a reference from the parent document, within the pagetable add new modal) EDIT: I have another issue now! When saving the clients page, which has the assignments pagetable field, it's triggering save() in the added pages, is there a way to avoid this?
-
Designme - Visually Layout Your Edit Screens - Preview
elabx replied to joshuag's topic in Modules/Plugins
@MrSnoozles and everyone! This project is certainly halted at the moment and we are discussing what to do with it. We have not publish because one of our original intentions was to make it a Pro module. We still need to clear our heads from work and decide what to do. -
Need help installing Mollie module with composer vendor files
elabx replied to bramwolf's topic in General Support
Maybe I'm being obvious, but have you tried running the shell command "composer require" on the root the module (site/modules/PaymentMollie)? Like this: composer require mollie/mollie-api-php EDIT: Fixed for correctness, thanks @MoritzLost -
Deface (Ruby on Rails Gem) is like ProcessWire MarkupRegions
elabx replied to Jonathan Lahijani's topic in Dev Talk
I just recently started using markup regions and gotta say I'm starting to like it a lot, but honestly I wouldn't think of anything actually "fancy", just really like working as if I were doing direct output, just like MarkupRegions proposes in its docs. -
Numbering and Pagination on Page Table field type
elabx replied to changwuf31's topic in Getting Started
Yes exactly @szabesz, ProFields Table (no pages involved). I also get confused haha- 6 replies
-
- 1
-
-
- pagination
- page table
-
(and 1 more)
Tagged with: