Jump to content

bernhard

Members
  • Posts

    6,629
  • Joined

  • Last visited

  • Days Won

    358

Everything posted by bernhard

  1. still i find chromes search shortcuts the best option - at least if you know where you want to search for your term... custom search for "custom admin"... lots of annoying ads (yes, i know you can "turn them off"...) search "pw custom admin" and finally searching in the blog: "blog custom admin" But maybe for newcomers such a search can be helpful (though I think someone already built one some time ago...)
  2. hi @owzim me again with a more important request i opened a PR on github to trigger an "loaded" event after acefy() is done. would be great to include this in your module, thanks
  3. hi @owzim i want to include your module in my kickstart module and found this issue on the uikit admin theme (full width font size input), would be great to get a fix for it thanks
  4. Ok just checked ASM inside an ajax loaded repeater with ajax loaded repeater items and this also works. Thanks for your example. That makes sense... Shouldn't it be possible to hook the buildForm method, check for your field and add scripts depending on the field settings there? A little This works: $wire->addHookAfter('ProcessPageEdit::buildForm', function($event) { $form = $event->arguments(0); foreach($form->fields as $field) { if($field->name != 'testasm') continue; if($field->inputfield == 'InputfieldAsmSelect') $this->config->scripts->add('/site/templates/scripts/alert.js'); else $this->config->scripts->add('/site/templates/scripts/otheralert.js'); } }); But I agree it would be nice to have this built into the inputfield somehow...
  5. true... though I had no problem with that so far and I can't really imagine a situation where this would be a problem? do you have an example? regarding the initial question: just tried an ASM loaded by ajax on a fresh DEV and it worked without any issues.
  6. Don't know about the core Inputfields but this can easily be done by adding scripts in the init() method of the module, not the render method.
  7. Credits to Ryan - I didn't know about that detail and he added it to the blogpost while proofreading it Sorry I think I misunderstood you try $headline = 'Happy ' . date('Y'); $this->headline($headline); $this->wire('processBrowserTitle', $headline);
  8. bernhard

    Fields

    There are several links inside this thread. Using google to search the forum works really well, see the link in my signature
  9. $wire->addHookAfter('InputfieldText::render', function($event) { $field = $event->object; if($field->name != 'title') return; $repeaterBtn = $this->modules->get("InputfieldButton"); $repeaterBtn->attr("value", "Generate something"); $repeaterBtn->attr("type", $submitID); $repeaterBtn->attr("id+name", "btn"); $repeaterBtn->attr("href", "/admin/page/edit/?id=1"); $repeaterBtn->attr("target", "_blank"); $repeaterBtn->addClass("customClass"); $event->return .= $repeaterBtn->render(); }); btw: panels are a great alternative for new browser tabs: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/#using-internal-components-modules
  10. bernhard

    Fields

    Hi @Jwenk and welcome to the forum, the preciser you ask your questions the better the answers will be What are you trying to do?
  11. hey @Federico i didn't read all your code but I would hook the inputfield's render method of the field that is inside the repeater. or you create a runtime markup field with your code. that might be easier. the only thing you have to take care of when hooking yourinputfield::render() is that the $field->name is not the field's name only but it has some appended or prepended string (repeater name or id, not sure at the moment... you can easily check this with tracy). always start without any additional checks/ifs/returns and then continue step by step until you get where you want, for example this in your /site/ready.php: $wire->addHookAfter('Inputfield::render', function($event) { $field = $event->object; bd($field->name); }); then you can modify the hook to only execute when needed (like hooking InputfieldText instead of the Inputfield base class, doing a return when the field name does not match...). i think @Robin S came up with a good solution how to check for the right field name inside repeaters but i can't find where he mentioned it in the forum. this is another way of checking that i used, but maybe robin can show us the better way
  12. I'm sorry @modifiedcontent but I put a LOT of effort in the blogpost, so as long as you don't come up with preciser descriptions of what EXACTLY you are trying to do I can not help. Maybe someone else understands your needs better and can therefore help you better. maybe a google search for "dashboard" has some interesting reads for you: https://www.google.at/search?q=site:processwire.com+dashboard
  13. hi modifiedcontent, this sounds a little strange. the easiest way of editing content is of course the normal pw edit screen. you can do a lot with normal pw features (like hiding fields on several conditions etc). if you really need more customized forms I show how you can do that here: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/#create-our-first-real-inputfields ; that's only one way of doing it. you can also easily modify the page edit forms via hooks. sorry for that. you can also start by using InputfieldRuntimeMarkup - maybe that's easier to begin with... totally up to you. you can create several pages in one module: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/#hello-page2 ; but you could also create one module for each page. It depends on you and your usecase which level of separation makes sense. sure, thats what i do throughout the tutorial. start with hello world, end with a custom CRM
  14. hm... @dragan i guess the runtimemarkup field only has to return the "<button>" element (without the <li>, <div.InputfieldContent> and so on... you are right see this post for example (and the following): and also this: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/#using-internal-components-modules (scroll down to the buttons section)
  15. Nice one Canada should be adrian's territory - I hope they hired him
  16. really nice feature introduced in november: live share (great way of collaborating with others!) https://code.visualstudio.com/blogs/2017/11/15/live-share ps: i don't want to abuse this thread for interesting stuff about vscode that is not related to processwire if that is not wanted...?
  17. @SamC great. Maybe you want to use less.js (http://lesscss.org/#using-less-third-party-tools) to show a very simple way of playing around with the admin themes LESS files? We could even build a theme generator using less.js and/or AIOM's php based less parser... Changing colors of the theme should be a lot easier than downloading source files, compiling everything, uploading...
  18. hi @theoretic this looks very nice. I'm just not sure about the blue link color... I think the main problem is that there is no guide at all of how to customize the uikit theme properly. Maybe you could share what we have to do in a tutorial?
  19. hi suntrop, I don't know why and I don't know if this is the best option (hooking is for sure also fine, or even better), but I like to create custom endpoints in the admin for that purpose via a ProcessModule. There i create an execute method (like executeMycustomcopyfunction) so that you can call this endpoint easily like this: <a href="/admin/page/mymodule/mycustomcopyfunction/?pagetocopy=123&newparent=456&copychildren=1">copy to new parent with children</a> In this method you can do whatever you want (don't forget to check permissions if that's important in your case). Somehow I found this way easier than hooking One drawback could be that you need to check if the page has some unmodified changes. I use my clone link on an overview-table so thats no factor in my case since the page is not being edited when clicking the clone link.
  20. The module supports less, you can also define variables there
  21. Ok sorry i shut up since I don't have a clue about this module
  22. of course you can! just clear your post data and redirect to the same page. If you do not show the submitted data, then this works (for example if you had a general "thanks for your message"). if you want to show data to the user (like "thanks alan for your message, we'll contact you soon") you could save that data to $session and display it from the session variable after clearing the post data. edit: actually the post data should get cleared already by the redirect
  23. I have never used this module so I don't know how it works but your problem can easily be solved by a redirect: https://stackoverflow.com/questions/3923904/preventing-form-resubmission
  24. If I remember correctly unpublished repeater pages get cleaned up by processwire at some time interval (I think one day or so). Would that explain your situation?
×
×
  • Create New...