When I’m in administration mode, using the 'seven' theme, and I click on Preview, instead of using the main theme, the preview uses seven's stylesheets, which is silly-willy because it’s not what I would expect from a preview.
-
Because that's the way it was designed and written by Drupal developers?– MołotOct 17, 2014 at 7:38
-
@gurghet i think you post this question in drupal meta for discussion meta.drupal.stackexchange.com– DRUPWAYOct 17, 2014 at 7:46
-
Thankyou mouot! I’d like to mark your question but I can’t figure out a way to do it.– gurghetOct 17, 2014 at 8:14
1 Answer
There are lots of reasons why the main theme isn't applied. I think this comment by merlinofchaos sums up some of the larger hurdles well:
Right now, in Drupal, we store temporary data in a cache by caching the generated form. In order to preview, we have to process that form and reassemble data. This is fine when you click preview, but in a system like this, you're actually visiting a different URL from the form.
Logically, we could put the form build id in the URL and load the form and process it, but there are several weaknesses with that:
- It is wasteful (processing a form that was not submitted)
- Form build IDs are sha generated strings. There is no way to reproduce it if you don't have it. This means you can't do content locking.
- It continues the trend on Drupal of the form owning the data when the form typically should only be a representation of the data.
Lot's of contrib modules have attempted to address these issues:
That said, "Allow to preview content in an actual live environment" recently made it into Drupal 8 Core
But don't get too excited. "Allow content creators to preview exactly how content will appear on the site after it's saved" is still very much a work in progress. And recent comments indicate it will be a Drupal 9, not 8 issue.