I had a look at calls to _preprocess_html
and _process_html
and what they do in core. I've listed what we need to provide and a summary of existing implementations.
It seems that everything existing in core can be potentially solved by:
- Providing the ability to add/modify attributes to the
<body>
tag and the<html>
tag. Most of the time, it's class attributes, but RDFa will have other needs. - Better asset management (CSS/JS). Preprocessors sometimes call
drupal_add_js
, etc. We're already talking about this in core. - Providing an API for theme hook/template suggestions outside of preprocessors. (There's an issue for this)
- Providing the ability to add/modify
<link>
and<meta>
tags, and the<title>
tag, all within<head>
. This is on sdboyer's radar. - Resolving apparent conflicts with contextual links and views contextual links. Now that views is out of contrib, we can probably fix this better. Arguably, contextual links should be pure JS? Not sure what work has been done here yet.
Setup some default variables and arbitrary zebra-striping. Wondering how necessary _template_preprocess_default_variables()
really is. Arguably most things here are unnecessary to the html template.
Sets up some classes and title suffix things, arguably should be done in pure JS, and likely not applicable to the html template.
Sets up any RDFa attributes and metadata attributes. We really need a better API for this than _process
functions layer.
Adds a class attribute to <body>
:
- front/not-front
- logged-in/not-logged-in
- Sidebar-influenced classes
- Theme hook suggestion name classes
Adds a class attribute to <html>
:
- Node type name
- Language and rtl/ltr
Adds a <link>
tag for favicon
Populates the <title>
tag
Adds <meta>
tags for mobile/responsive
Scans for theme hook suggestions
Adds a class attribute to <body>
Adds attributes to <html>
Something to do with a conflict with Contextual links
Adds a class attribute to <body>
Adding normalize CSS library and IE-specific CSS
Renders, adds assets, libraries. This can be refactored.
Has _color_html_alter
that seems to depend on some other _process_html
to add assets. This can be refactored.
A call to _color_html_alter
as mentioned above.