Recently Browsing 0 members
No registered users viewing this page.
By Thomas Diroll
Hi guys I'm relatively new to PW and just finished developing a page for a client. I was able to include all necessary functionality using the core fieldtypes but now I it seems that I need to extend them with a custom one. What I need is a simple button, that copies the absolute url (frontend not PW-backend) of the page which is currently edited to the clipboard. As this feature is only needed inside a specific template, I tend to use a custom fieldtype which provides this feature. I've been looking inside the core modules code (eg. FieldtypeCheckbox.module) but I don't really get the structure of it and how its rendered to the admin page. I also didn't find a lot of tutorials covering custom fieldtypes.
Maybe some of you could give me some tips on how to write a basic custom fieldtype that renders a button which copies the value of
page->httpUrl() to the clipboard using JS. Thanks!
I began writing this module from scratch, basing it off simple examples of modules, trying to learn the necessary methods required to create a fieldtype. I was WAY off, but learned a lot. Eventually I moved towards examining the FieldtypeEvents example from Ryan and, in many areas, copy/pasting and then adjusting the code (and then trying to determine what it all was doing) method by method, file by file (from his example to my module).
I've gotten to the point where I was ready to test the code - I haven't fully fleshed out my visual interface, nor integrated any of the 3rd party API tools this will (can) take advantage of. I also haven't implemented any JS or CSS for the interface. Right now I'm just trying to get it to save and then display any of the data that has been entered into the form fields of a template from the admin. When I save the page, the field is reset to defaults and no feedback message (for the field) is shown at the top of the page upon reload. When using Tracy Debugger from within the processInput method (immediately attempting to debug the $input variable), Tracy caught no data to be shown.
If anyone has some time to take a quick look and see what I might've done wrong I'd be super grateful. I've had no forward progress in about 3 days (and like many others was unable to get Xdebug breakpoints working in PHPStorm). 😞
Hi there! And thanks for Processwire!
Maybe i'm not very attentive but couldn't find any tutorial on creating custom fieldtype with custom inputfield. Would like to make one for selecting color(s) from predefined list of colors. The closest existing match is FieldtypeSelectOptions with InputfieldSelect but i need something different. There's a very good post from @Soma which is, however, insufficient to begin building my own fieldtype or at least to attach the existing inputfield to an existing field.
Will appreciate any help. Thanks in advance!
I just came across a potential error in the FieldtypePassword.
I have a password field added to some templates to protect the pages. However, whenever I want to save a page, I get the error of "required fiield missing"...that the password field is required and missing. But, the field is not set to required.
Can anybody confirm that and/or has a solution?