Jump to content

Process module adding items to sidebar template without file


gRegor
 Share

Recommended Posts

This is kind of a theme-related question (Reno), but also a Process module question, so posting it here.

I have a Process module I use to display new menu items in the left sidebar (Reno theme) for documentation. I handle displaying the documentation content through the module's ___execute and ___executeView methods, so I don't have a template file. The problem I'm running into is that the theme checks viewable() (reference) on each child page, and since there's no template file, none of the child pages get listed in the sidebar.

I'm wondering if there's some way to get around this "viewable" issue. I tried setting the documentation pages template to "admin" but as expected, viewing them gives me a "this page has no process assigned" error message.

I think this might be a feature request for the Reno theme, really, but wanted to post first in case someone had a quick solution I'm overlooking. Thanks!

Page structure:

- Admin
-- Documentation (template: admin, process: ProcessDocumentation)
--- How to do x, y, z (template: documentation, no associated template file)
--- How to do another thing (same)
...

Link to comment
Share on other sites

Good suggestion. That works to make the collapsible sidebar work in Reno, but when I click on one of the documentation pages I get a blank page. I guess the documentation template doesn't execute the parent page's Process, so the execute method doesn't get called? Is there any way to achieve this without needing to assign a Process to each documentation page?

Link to comment
Share on other sites

Bump. Any ideas on this?

I've now tried setting up the documentation.php template file with:

$page->process = 'ProcessDocumentation';
require($config->paths->adminTemplates . 'controller.php');

Based on admin.php, I would expect this to display the page contents in the default admin theme (Reno), but alas, it displays it in the legacy frontend layout (edit: the "skyscrapers" demo, though the navigation is all of the admin links). I've tried setting $config->defaultAdminTheme = 'AdminThemeReno'; in config.php but still no dice. I'm baffled at this point.

This is in PW 2.7.2

Edit edit: Alright after digging more, upgrading to 2.8.35, and digging even further, I feel pretty confident this is a bug, so I opened an issue.

Link to comment
Share on other sites

A bit off-topic, but have you considered any alternative ways of displaying documentation other than the approach your taking?

For instance, it seems like it would be a lot simpler if your documentation pages were displayed on the front-end. What I do for client documentation is this:

1. Create a documentation template. Don't give users edit access to pages using this template.

2. In the template file, perform a check that the user is logged in with the appropriate role, otherwise throw a 404.

3. Create documentation page(s) via the PW admin. I just use a single long page with a table of contents and anchor links but multiple pages would work equally well.

4. Insert links to the documentation page(s) into the admin theme for easy user access. I do this using jQuery via AdminCustomFiles because it's dead simple, but I think a hook would work too.

Link to comment
Share on other sites

I realized that's possible, but hadn't considered it much as an option. Since the documentation we're setting up is for doing specific tasks in the admin area, it seems a bit clunky to send them to a front-end page and then they have to return to the admin. I appreciate the idea, though!

Link to comment
Share on other sites

@gRegor - not sure if you already tried the Admin Help module, which is basically a documentation system that runs inside PW admin; one of the sub-modules is a process module that displays all of the documentation in an accordion page view...

  • Like 2
Link to comment
Share on other sites

  • 5 months later...

Just wanted to share what I ended up doing.

After a lot of digging and various attempts (see github), I gave up on having the documentation sub-pages show up in the sidebar. That means I was able to move the documentation pages elsewhere. I've been in the habit of having a page Backend Tools which doesn't have a template (so not available to the public) and store groups of pages there for things like Page-select options. I added a sub-page there Documentation Pages which allows children with template Documentation. The Documentation template just has a title and body field.

Then in my ProcessDocumentation module, the ___execute() method shows a list of all the Documentation pages, linking to them with the format: ./view/[page-name]. Then the __executeView() method verifies the page-name is valid and if so, returns the documentation page's body field, so it shows up in the admin theme. There's still a link to the main documentation page in the sidebar, which I think is good enough. Voila.

Link to comment
Share on other sites

Fyi AdminOnSteroids module is able to put pages to the sidebar. It is using Javascript to append the pages because there's no hook I could use so it may not fit your needs.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...