function metatag_mobile_page_attachments_alter(array &$attachments) {
if (isset($attachments['#attached']['html_head'])) {
// A list of core tags that will be replaced, in the format:
- // core tag => Metatag-supplied tag
+ // core tag => Metatag-supplied tag
// This assumes that the module's meta tags are output *before* the core
// tags, if this changes then We're Going To Have A Bad Time.
$dupes = [
foreach ($dupes as $core_tag => $meta_tag) {
foreach ($attachments['#attached']['html_head'] as $key => $item) {
- // The Metatag values are output before core's, so skip the first item
- // found so it can be picked up as the dupe; this is important for the
- // "viewport" meta tag where both core and Metatag use the same name.
- if ($item[1] == $meta_tag && !isset($found[$meta_tag])) {
- $found[$meta_tag] = $key;
- }
- elseif ($item[1] == $core_tag) {
- if (isset($found[$meta_tag])) {
+ if (isset($item[1])) {
+ // The Metatag values are output before core's, so skip the first item
+ // found so it can be picked up as the dupe; this is important for the
+ // "viewport" meta tag where both core and Metatag use the same name.
+ if ($item[1] == $meta_tag && !isset($found[$meta_tag])) {
+ $found[$meta_tag] = $key;
+ }
+ elseif ($item[1] == $core_tag && isset($found[$meta_tag])) {
// @todo This ought to work, but doesn't?
// $attachments['#attached']['html_head'][$key]['#access'] = FALSE;
unset($attachments['#attached']['html_head'][$key]);
/**
* Theme callback for an Android app link meta tag.
*
- * The format is:
- * <link rel="alternate" href="android-app://com.example.Example/sitesection/sitepage/thispage" />
+ * The format is (all on oneline):
+ * <link rel="alternate" href="android-app://com.example.Example
+ * /sitesection/sitepage/thispage" />
*/
function theme_metatag_mobile_android_app($variables) {
// Pass everything through to the normal 'link' tag theme.
return theme('metatag_link_rel', $variables);
}
-/*
-* theme-color
-* MobileOptimized
-* HandheldFriendly
-* viewport
-* cleartype
-* apple-mobile-web-app-capable
-* apple-mobile-web-app-status-bar-style
-* format-detection
-* android-app
-*/
+/**
+ * theme-color
+ * MobileOptimized
+ * HandheldFriendly
+ * viewport
+ * cleartype
+ * apple-mobile-web-app-capable
+ * apple-mobile-web-app-status-bar-style
+ * format-detection
+ * android-app
+ */