Hmm. Never written a module before, nor anything actually beyond the tutorial and the basic news pages I made that brought this on.
Oh and I'm working with SS version 2.3.7
[[ ATTACHMENT REMOVED AS LATER TIDIER VERSION BELOW ]]
Try out the attached module I made. It seems to work. Do have a good poke and tell me where I am going wrong or if it is fatally flawed. Then you'll have to fix it, ha ha.
Not sure if it is breaking anything - seems okay even if it looks like it messed with my News pages (as above - why I'm doing this) but I'll take them back to a base stage first to verify. It may of course affect all the various get children calls in a Bad Way *grin*
I have tried to make it reasonably configurable so have gone beyond your original single checkbox. As mentioned in the code it tries to cope with whatever is put in there and return some sort of list as a result, preferably with useful notes like e.g. 'could not find page type NonExistentPage, dropping back to SiteTree'. Needs to have a yes/no debug checkbox to hide these in production.
Needs:
* How do you get the CSS into the CMS? I tried putting it in hidepages/css/HidePages.css and pulling in from the _config.php into both the display system and the LeftAndMain but no joy. It would be nice to use styles in the code so the children list formatting can be properly controlled by CSS.
* Some way to unpublish & delete child page in list without having to go to edit page. A link to a method is I think the way to go but not sure.
Notes:
* I've tried to make it break-proof, especially when mixing invalid page types and partially existent sortBys. It has to be - e.g. if a page type is removed but still set it will have the metaphoric rug pulled from under it and must try to be graceful about it.
THAT SAID I may have not found all cases where the failing select statement generated by the UseType and SortBy combo gives you a constantly crashing admin page, so you can't use that to back out. Here you need to nip into the SiteTree table in the database and alter one or other of the HidePagesUseType and HidePagesSortBy values in the record for the page.
The record ID for updating the relevant column to NULL is usually easily found. Here e.g. for the times it used to go bad after setting UseType to 'DataObject': "select ID,HidePagesUseType,HidePagesSortBy from SiteTree where (HidePagesUseType is not NULL) and (lower(HidePagesUseType) = 'dataobject');".
* The Date and endDate stuff? That's to provide personal list style support for my news article pages (O: Although I had thought that you could put them in via the decorator and default them to now() so you'd always have some sort of date associated with SiteTree.
To Do:
* Debug checkbox to dis/en-able the tiny diagnostic messages.
* Set so that any listed on the tree side, for when some but not all will be shown, are the top X sorted on the workable combo of usetype and sortby 'cause that would seem to be a desired behaviour. e.g. if it was a blogroll and you wanted to have the 5 most recent visible in the tree.
And onwards...