User tests: Successful: Unsuccessful:
The ErrorDocument
class (formerly JDocumentError
) is a massively neutered version of an HTML rendering document. In 3.x and earlier the document type was used to serve all error pages, and being format unaware, this meant requests trying to use XML or JSON formats (as an example) always got an HTML document; luckily that issue is addressed in the 4.0 API, but until now the limited use of the ErrorDocument
class hadn't been. Well, now it is.
ErrorDocument
is undeprecated and refactored to be a subclass of our HtmlDocument
with this pull request, meaning error.php
template files can make full use of our HTML document features. Gone are the days of "fun" workarounds to load media assets to the page or rendering modules, the error HTML document is a true first class citizen of the presentation layer now.
The error pages for our themed templates are refactored to adapt to this approach, the system and install app templates need fixing still.
As a bonus, I've split up the error page for the backend template. Because we use two distinct layouts for the login page versus being logged in in full, instead of filling the template full of conditionals to selectively render bits and pieces I've just split it up into a file specific for unauthenticated users (meaning your login screen is giving issues and you're really screwed) and a file for authenticated users (the existing layout).
Apply the patch. Raise an error. Watch it be rendered correctly. Go wild, add some module positions specific to the error page and configure the error page to display that unique set of modules.
Yep. Let's see...
Rendering an error page resets the document object in Joomla\CMS\Factory::$document
, the rationale being we want a clean document to work from; if the error page is triggered we aren't interested in the metadata your component has set, or the media added from some bad module, or whatever plugins are adding to the display. We want a clean environment for rendering the error page only containing the error page's loaded data.
ErrorDocument
class inheritance is changed, shouldn't break instanceof
checks because it's moved to a subclass but technically this can be a B/C break if going about things the right way
Realistically, 3.x and earlier conventions for building an error page should keep working (minus the factory document reset, if you were relying on that for some reason), but don't encourage it
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Templates (admin) Libraries Front End Templates (site) |
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-06-13 11:47:57 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
?
|