Search the Community
Showing results for tags 'button'.
-
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'm coding my first module now. I've just managed to add a button to the page edit form but am not content with its placing. Is there any way to place it just next to the input field? I've marked the desired place with the arrow on the attached screenshot. My current code: $this->addHookAfter('ProcessPageEdit::buildFormContent' , $this, 'addButton'); public function addButton($event){ $form = $event->return; $f =$this->modules->InputfieldSubmit; ... $form->insertAfter($f, $form->get("bgg_id")); } "bgg_id" is the name of the targeted field.
-
it turns out that if you create a PageTable field and assign only one (1) template you get a 'add new' button. it does NOT use the label from that template. but when you assign two (2) or more templates the system will use the template labels to lable the buttons. i feel it should use the template label for the button even if one template is assigned. this topic came up in the general support area, here.
-
Hi there, I need a radio button fieldtype. The checkbox field only allows one value, right? I need a field that displays a list of radio buttons, in which the user has to pick one. Is this available through processwire? How can I do something like this? Thanks in advance
-
Hello everyone, I'm looking for a way to add a submit button ('Generate PDF') for a set of templates, which generates a PDF when clicked. So, a submit-button field to which I can attach attach a piece of code. I don't want to run it every time I save, because that will be too much time-consuming. I found https://processwire.com/talk/topic/8457-add-a-new-action-button-to-page-edit-screen/?hl=%2Badmin+%2Bbutton , but I can't seem to get it working. It should be placed inside the admin.php file right? Or is making a module the best way to do this... Best, Charlie *** EDIT *** I'm currently in the middle of making the [GENERATE PDF] button module. I found the Page::editable hook which works great. Somehow it also parses immediately the parent, and because I only want to parse the current page, I remove the parent like this: $page = $event->object; $page->parent = ""; // remove parent! Is this good/okay/bad practice? Then I'm trying to add a button to the template like the following: $field = $this->modules->get('InputfieldButton'); $field->attr('name', 'generate_pdf'); $field->attr('class', $field->class); $field->attr('value', '[GENERATE PDF]'); return $event->return->append($field); But this throws me an error on the appending (Error: Call to a member function append() on boolean (line 60)... The follow up question would be: how can I add an event to when this button has been clicked, and use the current available information of that page
-
Hello all, I am thinking how to make a "simple" button that could be edited by user. For example in a situation where we have an editable teaser and we want to add a internal link to some other page under it. The button/link would take two parameters: 1.) Text that is displayed on a button (in different languages!) 2.) Page to which button would link to. 3.) Optional: instead of page object, one could also enter external address. System admin should also be able to add class name that would be added to rendered element. Field would then simply be used as: $page->button and it would render <a class='custom-class' href="$page->url">Text (in appropriate language)</a> I noticed it is sort of similar to this module, but with an option for user to select one of the pages (instead of writing down an ID). My first thoughts were to create Fieldtype/Inputtype module, but it seems sort of complicated (I don't know how to use neither FieldtypeTextLanguage nor FieldtypePage in module). So I wonder, how you guys are solving this problem? Thanks! Žiga PS. I am not sure I added this to the right section. If not, please feel free to move it where it's suppose to be.
- 13 replies
-
- button
- FieldtypeTexlLanguages
-
(and 3 more)
Tagged with:
-
I'm trying to create a module that will execute functions when a button is pressed. What would be the best way to implement this? The options I've considered are: Using a Process and creating a page in the admin section of the website; Or perhaps creating a module and having a button on the settings page; There are probably other ways to do this that I haven't considered. I'd be open to suggestions. Thanks for any help
-
While developing my dashboard module I came across a lot of difficulties when building a configurable filter for selecting pages for the last pages widget. Some things I discovered: "or" filter in native page fields didn't work. Fixed by Ryan in the last commit (Big thanks!): https://github.com/ryancramerdesign/ProcessWire/commit/70093241b2cbfe7cae79f28531c1a5df1a572169 It is was somehow difficult/impossible to use get('/')->find(...). This resulted in weird results where direct children were not in the results array. Should also be fixed (not tested). There is an undocumented selector "has_parent" which looks for a parent up to the root. Quite handy! So "has_parent!=2" removes all admin pages (except admin itself, add id!=2 for that) from a select (thanks @Soma!). The "user" which created the standard pages is not the superuser. This was the reason I doubted my results because I thought the superuser would have created everything. Me stupid. The inputFieldSubmitButton module generates a button which gets doubled in the admin head section. Couldn't find the place where this happens until I found out that this is generated with Javascript. Me stupid again. Important rule for selectors: First "has_parent" (if needed), second "include=all" (if needed), then the other filters. And in the end "sort" and then "limit". Not sure about this, but this works for me, so I have only one selector which seems to be correct. For example the latest pages for a specific user which are not admin pages (and no trash): has_parent!=2,id!=2|7,include=all,created_users_id|modified_users_id=41,sort=-modified,limit=10 Looks easy, but wasn't (at least for me)