[development] drupal_add_head -> $page[hook_alter_page Re: global object to push stuff into <head>
Ivan Sergio Borgonovo
mail at webthatworks.it
Thu May 7 15:17:35 UTC 2009
On Tue, 5 May 2009 11:41:47 -0500
Jeff Eaton <jeff at viapositiva.net> wrote:
> On May 5, 2009, at 11:19 AM, Ivan Sergio Borgonovo wrote:
>
> > So there is no way to edit in a structured way head.
> In Drupal 7, I'd really love to see the globally alterable $page
> array become a place where this stuff lives. hook_page_alter
> already exists...
I was giving a look to the current status of D7 and trying to
understand how to put stuff in the $page.
I like the $page approach too compared to the drupal_add_* since
$page doesn`t look as a global (am I right?)
There are really few places that use _page_alter that could be a
guide to understand how $page look like.
book_page_alter (no use)
block_page_alter
Furthermore I think that just finding a place in $page is solving
half the problem.
I can`t think of any way a _page_alter could get the content of a
*part* of a page and modify it that could be general enough to
provide some standard method to help modifying it.
I`m just guessing since it seems to appear that a $page is mainly
constituted by regions and blocks but then everything become
arbitrary html.
But head has a more regular content with some rules that makes
some modifications meaningless and somehow can contain much less
variety.
Maybe a set of helpers that will make it easy to access/modify a
$page['head'] and every module that need to modify head could do so
in hook_alter_page?
Having a structured head implies having a renderer/theme function (am
I right?)
This should support everything that already ends up in head... namely
LINK [1] and META
Is there anything else that could end up in head?
I didn`t see anything else at w3c.
META
http://www.w3.org/TR/REC-html40/struct/global.html#h-7.4.4
LINK
http://www.w3.org/TR/html401/struct/links.html
Maybe we could have a structured $page['head'][..] + an unstructured
$page['head']['markup']
There is also this "orphan":
meta_generator_header
that could be treated more uniformly
thanks for any input
BTW
I`ve noticed that head is filled several times (?)
by:
system_preprocess_page
emplate_preprocess_book_export_html
template_preprocess_maintenance_page
and
template_preprocess_page
is it correct?
[1] is it ok to use drupal_add_html_head in
openid_test_html_openid1
openid_test_html_openid2
openid_test_yadis_http_equiv
in spite of
drupal_add_link
?
--
Ivan Sergio Borgonovo
http://www.webthatworks.it
More information about the development
mailing list