Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / metatag / metatag_mobile / metatag_mobile.module
index 6b3ff052c1f8c7a2cc6974932cd4da1a0630fcde..a1778779a72a9123a70ce21a187be35b1adcc000 100644 (file)
@@ -43,7 +43,7 @@ function metatag_mobile_theme() {
 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 = [
@@ -58,14 +58,14 @@ function metatag_mobile_page_attachments_alter(array &$attachments) {
 
     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]);
@@ -79,8 +79,9 @@ function metatag_mobile_page_attachments_alter(array &$attachments) {
 /**
  * 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.
@@ -104,14 +105,14 @@ function theme_metatag_mobile_ios_app($variables) {
   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
+ */