diff --git a/uw_cfg_common.module b/uw_cfg_common.module index 43e628235c9c88d534160ac8fbb4584487086d1c..a554aebff3bfc8d1a076c6e7307a7b04e3cda40a 100644 --- a/uw_cfg_common.module +++ b/uw_cfg_common.module @@ -17,12 +17,14 @@ use Drupal\webform\WebformSubmissionStorageInterface; */ function uw_cfg_common_metatags_attachments_alter(array &$metatag_attachments) { // Check if the image and og:image fields are empty. - // We do this here instead of in hook_metatags_alter() because we want to check if they're empty after tokens have been applied. - // We also want to support the use case where they don't upload an image, but do manually specify an image. - // Because of where the information is stored, we have to loop through to find it. + // We do this here instead of in hook_metatags_alter() because we want to + // check if they're empty after tokens have been applied. + // We also want to support the use case where they don't upload an image, + // but do manually specify an image. + // Because of where the information is stored, we have to loop to find it. $found_image_src = FALSE; $found_og_image = FALSE; - foreach ($metatag_attachments['#attached']['html_head'] as $id => $attachment) { + foreach ($metatag_attachments['#attached']['html_head'] as $attachment) { if ($attachment[1] == 'image_src') { $found_image_src = TRUE; } @@ -31,7 +33,7 @@ function uw_cfg_common_metatags_attachments_alter(array &$metatag_attachments) { } } - // Define what the fallback image is, so if it changes we only change one thing. + // Define what the fallback image is, so we only need to change it once. $fallback_image = 'https://uwaterloo.ca/university-of-waterloo-logo-152.png'; // If the image_src field is missing, create one with the UWaterloo logo. @@ -42,7 +44,7 @@ function uw_cfg_common_metatags_attachments_alter(array &$metatag_attachments) { '#attributes' => [ 'rel' => "image_src", 'href' => $fallback_image, - ] + ], ], 1 => 'image_src', ]; @@ -56,7 +58,7 @@ function uw_cfg_common_metatags_attachments_alter(array &$metatag_attachments) { '#attributes' => [ 'property' => "og:image", 'content' => $fallback_image, - ] + ], ], 1 => 'og_image_0', ];