The way that the $head variable is being altered in adaptivetheme_mobile_preprocess_page() is heavy-handed.

Currently it's replacing the whole of $head, building it from scratch. The problem is that $head may already contain important meta, link, style or script elements arising from various modules.

The core book module, for example, includes standard HTML links in $head, like so...

<link href="/node/59" rel="prev"/>
<link href="/node/59" rel="up"/>
<link href="/node/61" rel="next"/>

Some browsers (or browser extensions) build user interface widgets from these, and it's quite conceivable that some mobile devices might be able to make use of them; they could work well with direction-pad button. The range of rel="" types is proliferating; HTML5 adds a whole new bunch, IIRC.

There are also quite a few contrib modules that add CSS style elements to the $head variable, e.g. Fivestar. They don't use drupal_add_css because they're building the CSS programatically.

What's really needed is to extend the $head variable during preprocessing, adding your new elements to the existing array.

Marking this issue critical since it breaks functionality of the core book.module and several from contrib.

Comments

andrewmacpherson’s picture

StatusFileSize
new1.07 KB

Here's a fix. I'm treating the whole of the existing $head value as the first value in the array being built.

An alternative way is to simply say:

$vars[head] .= '<link/>';
Jeff Burnz’s picture

Yes, good point, it was kinda a quick hack, I removed all the code last night when I was testing out touch_icons so I found the problem then, thanks for the patch, will commit later today. Cheers!

I'll wrap an if (module_exists(touch_icons)) around the apple-touch-icon link tag as well ;)

andrewmacpherson’s picture

Thanks Jeff.. and touch_icons isn't even out the door yet!

Jeff Burnz’s picture

Status: Active » Fixed

Committed to head, will update with beta2 shortly.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.