renobird Posted March 11, 2014 Posted March 11, 2014 diogo, Didn't mean any disrespect to this module or it's usefulness — I hope my post didn't come off that way. I used this module for while when you first released it, and I agree it makes the process of creating new admin pages pretty easy. What I've realized is that the build-in process is really just as easy (IMO). I think you should definitely continue to develop/support the module. I just wanted to give a quick example of a simple Process Module that is build much like you might in a template.
diogo Posted March 11, 2014 Author Posted March 11, 2014 Didn't mean any disrespect to this module or it's usefulness — I hope my post didn't come off that way. Not at all, don't worry about that 1
apeisa Posted March 11, 2014 Posted March 11, 2014 Same here. I think one fundamental difference is that admin template (and therefore process modules) doesn't have fields. Admin pages created by this module can have fields (if I have understood correctly how this module works).
diogo Posted March 11, 2014 Author Posted March 11, 2014 Antti, you can create a normal template (with fields and a template file) for a custom page in the admin, and use $page, $pages, etc. instead of wire() 1
Macrura Posted March 11, 2014 Posted March 11, 2014 i think there will always be a use for this, even if you can easily create your custom pages in a process module; the other day i was in a meeting and the client asked for a point-of-sale page in their admin, using foxycart, but with blank fields; so with a few clicks and a 5 line form they had their POS and were able to use it within 10 minutes; i could go now and tighten it up and make it into a process module, but this is a low budget site, so they actually can't afford that. 2
kongondo Posted March 11, 2014 Posted March 11, 2014 (edited) Correct me if I am wrong (can't remember), with this module, for new items, I just need to create another page and assign it it's own template and template file? With Process Module, you would need to install a module each time you want a new item in the Admin.... Edited March 11, 2014 by kongondo
renobird Posted March 11, 2014 Posted March 11, 2014 With Process Module, you would need to install a module each time you want a new item in the Admin.... You just need to create a new page and assign it the process you want. The methods are pretty much 50/50 on that one. They both require a new page and some setting to tell that page what template/process to use. 1
Macrura Posted March 12, 2014 Posted March 12, 2014 I agree — ProcessModules are the way to go. They might look intimidating at first, but if you start with a very simple example, they really are very easy. Here is a super simple example that lists all pages with the template "news" @renobird - thanks for posting this; I just converted an admin page that was using this module to a process module, and your example helped... guess i'll be moving on and converting the rest of my admin pages to use process modules... thanks again to everyone posting about this! 1
renobird Posted March 12, 2014 Posted March 12, 2014 Macrura, Glad to have helped. I will warn you, creating simple ProcessModules are a gateway drug. Once you start creating modules, it's addicting. As has been stated by others, there are definitely cases where using the module is a good choice too. 3
kongondo Posted March 12, 2014 Posted March 12, 2014 ...... I will warn you, creating simple ProcessModules are a gateway drug. Once you start creating modules, it's addicting. Tell me about it! 2
Nico Knoll Posted April 17, 2014 Posted April 17, 2014 Hey, I forked this project and created a version which is a lot simpler but only runs on PW 2.4 or higher. https://github.com/NicoKnoll/pw-admin-custom-pages What do you think? @diogo Maybe you can merge them somehow and move your version in an "PW lower than 2.4" folder or so. 5
kongondo Posted April 17, 2014 Posted April 17, 2014 (edited) Hey Nico! Cool! Very simple installation!!! A small bug: There is a missing $this-> on line 71 of FieldtypeAdminCustomPagesSelect.module. It throws an error 'Call to undefined function rglob()' when trying to create the admin page. Should be $thix->rglob() A minor suggestion: Using the term 'template files' on the select can mislead some; the selection being made is technically a 'template' whose 'template file' will then be rendered . Thanks! Edited April 17, 2014 by kongondo
kongondo Posted April 17, 2014 Posted April 17, 2014 @Diogo +1 for merging please . The installation is much simpler! 1
Manfred62 Posted April 17, 2014 Posted April 17, 2014 @Nico: making the strings translatable? Think, this should be done in general with every new module. 2
Nico Knoll Posted April 17, 2014 Posted April 17, 2014 I made it translatable and added Kongondos stuff
diogo Posted April 17, 2014 Author Posted April 17, 2014 Nico, for what I understand this version wouldn't allow to create custom fields on the page, right? another problem is that, because we create a php file inside templates but not a template for it, this will always be suggested by PW for new templates which might get a bit annoying. If there are solutions for these, I will be glad to merge
Nico Knoll Posted April 19, 2014 Posted April 19, 2014 Hmm, what I think: Custom fields: You normally create a custom template file for each of the custom admin pages so I don't think you'd need custom fields here. And if you think about using the same custom admin page template multiple times you can use $page->name to difference them. Templates: I understand your point but first I don't see them as real templates but as subtemplates. Of course it probably is a bit cleaner to create a template for each. But as you already mentioned: it's really annoying. Especially if you can't use the fields added to the template anyway. I'm not sure which solution is the best one here, so I would go with the easier. If you would prefer to have a template for each file I would rewrite the select field to select templates instead of files from the template folder. (P.S.: I'm not sure if this is an equivalent comparison but admin pages like "setup" don't have a special template, too, only a file rendering the template and stuff like this). 1
diogo Posted April 20, 2014 Author Posted April 20, 2014 Nico, I'm sorry but still didn't have much time to look into this. I'll try to do it later today. I will merge your version since it works well with 2.4, and that's the most important anyway. We can try to fix the details I mentioned later. Thanks for working on this 3
Nico Knoll Posted April 20, 2014 Posted April 20, 2014 You're very welcome I just thought it's a really helpful module and had some spare time
diogo Posted April 20, 2014 Author Posted April 20, 2014 So, I accepted Nico's pull request, and his changes are now in the master branch. If someone wants the previous versions, they are in the "pre-nico" and "pre-nico-dev" branches 4
alan Posted May 8, 2014 Posted May 8, 2014 FYI diogo, not important, I just spotted a typo in the info on the Modules page, where you link to Nico you've got https and Chrome gets all sulky and jaundiced as the site is http. See, I have my uses—I may be too thick to produce a Module but show me a spelling mistake and I'm ALL over it. 1
diogo Posted May 8, 2014 Author Posted May 8, 2014 Thanks Alan! I corrected the mistake. Apparently the awesome guy doesn't know his own URL 1
Alexander Posted July 10, 2014 Posted July 10, 2014 Good day everybody, I'm trying to make Custom Page with one of Pages Tree. I took this code https://processwire.com/talk/topic/6315-processpagelist-to-hide-some-pages/?hl=backend for custom page template: <?php $form = $this->modules->get('InputfieldForm'); // prep the form $wrapper = new InputfieldWrapper; // a wrapper $wrapper->attr('value', 'List of available articles'); $p = $this->modules->get('ProcessPageList'); // kongondo's code goes here $p->set('id', 4049); // setting the parent page $pageTree = new InputfieldMarkup; // the placeholder $pageTree->value = $p->execute(); // fill the InputfieldMarkup form field... $wrapper->add($pageTree); // put inside the wrapper... $form->append($wrapper); // append the wrapper ?> No success. The main idea is to give to each user separate space for editing only his pages and prevent access to system pages and pages of other users. What did I miss? Thanks for any hints.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now