Jump to content

Search the Community

Showing results for tags 'hook'.

  • Search By Tags

    • hook ×
    Type tags separated by commas.
  • Search By Author

Content Type



Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


  1. Hey Procis, wrote this - and my very first - hook „Prepend date in page name“, yesterday. Once you get it, this system and the API is magnificent. Thank you @ryan and @all contributers! On new (news) pages it works great so far. E.g.: Title: Testnews mit Ümläüten Altered page name: 2024-0...
  2. I have a hook in a ready.php file, that is supposed to fill a page’s field when a public form is submitted. wire()->addHookBefore("Pages::saveReady", function(HookEvent $event) { // do all that for font pages only $page = $event->arguments(0); // avoid the error “page can’t be saved” if...
  3. Not sure whether it's a bug, an inherent limitation of hooking findReady, or that I need to hook some other code as well, but I've found that while hooking findReady can allow me to modify the list of selectable pages for page Autocomplete inputfield for page fields without problem, on save, the dat...
  4. Hey all. This might sound a bit strange but I am looking for a solution to hook into page edit and remove or disable the two save buttons including their dropdown options. I managed to partly remove the buttons, but the dropdowns remained. However, I would prefer a solution with disabled...
  5. I've spent way too much time trying to figure this out so now I just have to ask. I added an option to the save button when editing a page. What I want it to do is, when clicked, send an email out to the appropriate person, change a field on the page, then save. I have everything working up unt...
  6. $wire->addHookAfter('Pages::added(template=booking)', function(HookEvent $event) { $page = $event->arguments(0); $selectable_pages = $page->getInputfield('booking_group')->getSelectablePages($page); $current_group = $selectable_pages->find("template=booking_price, parent.bo...
  7. Hi, I want to redirect users that hit 1) pages using a specified template 2) when the url is using a specific syntax. Url syntax is: /PRODUCT/redir/PAGEID Example: /foo/redir/1234 My intention is to redirect the user to the specified PAGEID - but I don't know how to user $input in...
  8. Hi PW fanatics In this post I share two of my addHookMethods for those interested. As you surely already know (if not, time to take a look at it) the Wire::addHookMethod() and the Wire::addHookProperty() API methods can be used to "breath some extra OOP" into your projects. Using addHookMe...
  9. Hi I'm working with PW for some time now, but – please don't laugh – never used hooks. I have 200 – 300 subpages with the template 'artist', the title of each page represents the full name, sometimes John Doe, sometimes John Emmet Brown Doe. I want to auto-populate the field 'artist_last_n...
  10. I use a PageTable field to make edits to children of pages more intuitive… To register the hooks, insert the following Snippet inside your init function in your module (or add it to your init.php file): /** * Initialize the module. * * ProcessWire calls this when the module is loaded. Fo...
  11. So hello i am trying to get a .png file from file field and put it automatically to image field, why png image is in the file field is because i already have a hook that extracts .zip and uploads all content into file field, but i just realizes i cant use size() function on image in file field so i...
  12. Hi! I am trying to create a hook that takes the value of a form file field, and add it to an image gallery of an existing page. $forms->addHookBefore('FormBuilderProcessor::processInputDone', function($e) { $form = $e->arguments(0); if($form->name == 'new-inuse') { // related_font is a page...
  13. so what i am trying to do is that i uploded some files into file field, and then i want hook to get MD5sum and other stuff from .xml and put it into text field into it coresponding pages, pages like this are gonna be many, for each one i want it to output it into its fields
  14. Hi there. I wrote a custom module for one of my projects. In fact I maybe want to use my module in other projects too. In order to be variable and customizable I need to implement some custom hooks into my module. So I can afterwards hook into the my functions in order to modify them to match the n...
  15. Hello so am trying to make a hook so that all checkbox field is defaul;ty checked when making new page, soo i made hook in init.php and the contents are <?php $wire->addHookAfter("Pages::added", function($event) { $page = $event->arguments(0); // check for page template if necessary here $...
  16. Hi folks, i try to use a hook to change some markup inside admin, this hook works fine inside a ready.php file, but its not working inside my module: <?php namespace ProcessWire; class InputfieldPageTableExtendedGrid extends InputfieldPageTable { public static function getModuleInfo() {...
  17. Hello Till now I hacked something with the twig template but it works no more with new PW versions so I look forward to create a module. I am working on a site in multiple languages : French, English, Italian, German, Spanish, Portuguese, Hebrew, Russian. The new posts are entered in any langua...
  18. Hello, I have a hook in a custom method of a non autoload module and it is not calling my hook method. In the wiki I read Modules that are intended to attach hooks in the application typically should be autoload because they listen in to classes rather than have classes call upon them. If the...
  19. Hello all, wasn't sure where to put this, so it goes in General section. Ryan shows a hook that we can use to mirror files on demand from live server to development environment to be up to date with the files on the server without having to download complete site/assets/files folder....
  20. I'm trying to update certain repeater fields with a hook. This almost works, but is somehow buggy. Each repeater is supposed to represent a row: service, remarks, number of days, day-rate, row total. The last repeater should then show the grand total. I've tried this: $this->a...
  21. Hello! The only hook into 'trash' in a module runs twice, by itself, as it seems. The following code outputs: Session: Hooked 1 times on abcd Session: Hooked 2 times on abcd on the admin side when one page is deleted from it's delete tab. And it's no matter 'addHookBefore', 'addHookaAfter' or...
  22. I've created a simple sports league fixture generator in a template called 'League'. Teams are added as page references then a fixture list is created as a ProFields table by hooking page save to add new rows to the table. The bit I need help with is that I'm trying to check a fixture doesn't a...
  23. It's a bilingual site. There are two pages: "Artists" and "Events" each with a "Page Reference" field connecting each other. - Artists has a field where one can choose events available. - Events has a field where you can either choose artists available or create new ones. The problems...
  24. Hello forum! I started to write my first hook for Processwire but I'm pretty confused how you should write these. My idea is to hook after publishing in init.php (called before templates) for a certain template. Here's the code: Trying to reset the checkbox (ajasta) an...
  25. In a project I had to add the attribute 'disable' to some options of a select field (page reference) to show them but make them unselectable. Since I could not find an integrated solution, I wrote a tiny module and a hook. This could also be a POC to similar needs. Install module Add the...
×
×
  • Create New...