Thomas Diroll
-
Posts
3 -
Joined
-
Last visited
Posts posted by Thomas Diroll
-
-
@elabx Thanks for the fast reply! This actually looks like a nice way to implement own code! I will take a look at it. Thanks!
-
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!
How to create a copy URL Fieldype?
in Module/Plugin Development
Posted
Thanks for all your answers!!! This was really fast and seems like a very active community! I'm sure the code snippet by @szabesz and the fieldtype by @kixe will work as well and are definitely more lightweight. I went with the RuntimeMarkup fieldtype suggested by @elabx as it was the fastest and easiest one to apply. Here is my php snippet for the runtime field:
It creates an a-tag which is styled like a backend button. Hope its useful for someone else!