From 89381d171c56051ea28d7f4771e458c92249a73b Mon Sep 17 00:00:00 2001 From: kpaxman <kpaxman@uwaterloo.ca> Date: Fri, 12 Mar 2021 18:13:44 -0500 Subject: [PATCH] ISTWCMS-4104: code standards --- uw_cfg_common.module | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/uw_cfg_common.module b/uw_cfg_common.module index 43e62823..a554aebf 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', ]; -- GitLab