Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Template controllers not loaded in 'draft' mode #70

Closed
abstrakt opened this issue Feb 21, 2018 · 6 comments
Closed

Template controllers not loaded in 'draft' mode #70

abstrakt opened this issue Feb 21, 2018 · 6 comments

Comments

@abstrakt
Copy link

It seems that the correct controllers are not being loaded when previewing a page in draft mode. However, Sage 9 does successfully load the correct view.

It loads all the basic controllers:

  • controllers/app.php
  • controllers/index.php
  • controllers/singular.php
  • controllers/page.php

But unfortunately not the template that is assigned to it.

@darrenjacoby
Copy link
Member

I will test and look at fixing in 2.0.2

@darrenjacoby
Copy link
Member

This is working with 2.0.1 from my testing. I'd recommend upgrading and trying again. roots/sage#2025

@slackday
Copy link
Contributor

Hi @darrenjacoby can you test this again? I'm having the same problem and I have tried updating to 2.1.0.

When assigning a custom page template the normal Page controller is loaded. And I don't use $tree = true on the custom template controller.

@darrenjacoby darrenjacoby reopened this Sep 12, 2018
@darrenjacoby
Copy link
Member

@slackday I'm pretty busy for the next month but will take a look when I have a chance.

@slackday
Copy link
Contributor

I had some time today to tackle this problem again. Turns out it was not an issue with the Controller itself but rather an upstream error in brain/hierarchy which the Controller uses.

When a page with a custom template is in preview (before it is saved first time) it does not have a page_name. The hierarchy would return standard Page/Singular hierarchy.

I suspect the reason this would work for some people and not for others is the difference if the page would be previewed first time or after it had been published.

I have created a PR which solves this issue. I hope it can be merged soon or if the maintainer comes up with a better solution. I don't know the inner works of Hierarchy nor the Controller so this was quite dive 😄.

@darrenjacoby
Copy link
Member

Thanks for investigating @slackday , it looks like progress is being made over at brain/hierarchy. I will close this for now, and update the version of brain/hierarchy on dev-master soon.

@slackday slackday mentioned this issue Nov 2, 2018
darrenjacoby pushed a commit that referenced this issue Dec 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants