From fbb607664d7198fe70b8f535be42efa4820b0a59 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 2 Dec 2024 13:38:00 -0800 Subject: [PATCH] Rename add_preload_link to add_image_preload_link Co-authored-by: felixarntz --- ...age-prioritizer-background-image-styled-tag-visitor.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/image-prioritizer/class-image-prioritizer-background-image-styled-tag-visitor.php b/plugins/image-prioritizer/class-image-prioritizer-background-image-styled-tag-visitor.php index 293593e80..91c20ec0a 100644 --- a/plugins/image-prioritizer/class-image-prioritizer-background-image-styled-tag-visitor.php +++ b/plugins/image-prioritizer/class-image-prioritizer-background-image-styled-tag-visitor.php @@ -45,6 +45,7 @@ final class Image_Prioritizer_Background_Image_Styled_Tag_Visitor extends Image_ /** * Tuples of URL Metric group and the common LCP element external background image. * + * @since n.e.x.t * @var array */ private $group_common_lcp_element_external_background_images; @@ -87,7 +88,7 @@ public function __invoke( OD_Tag_Visitor_Context $context ): bool { // If this element is the LCP (for a breakpoint group), add a preload link for it. foreach ( $context->url_metric_group_collection->get_groups_by_lcp_element( $xpath ) as $group ) { - $this->add_preload_link( $context->link_collection, $group, $background_image_url ); + $this->add_image_preload_link( $context->link_collection, $group, $background_image_url ); } $this->lazy_load_bg_images( $context ); @@ -169,7 +170,7 @@ private function maybe_preload_external_lcp_background_image( OD_Tag_Visitor_Con && $processor->get_attribute( 'class' ) === $common['class'] // May be checking equality with null. ) { - $this->add_preload_link( $context->link_collection, $group, $common['url'] ); + $this->add_image_preload_link( $context->link_collection, $group, $common['url'] ); // Now that the preload link has been added, eliminate the entry to stop looking for it while iterating over the rest of the document. unset( $this->group_common_lcp_element_external_background_images[ $i ] ); @@ -186,7 +187,7 @@ private function maybe_preload_external_lcp_background_image( OD_Tag_Visitor_Con * @param OD_URL_Metric_Group $group URL Metric group. * @param non-empty-string $url Image URL. */ - private function add_preload_link( OD_Link_Collection $link_collection, OD_URL_Metric_Group $group, string $url ): void { + private function add_image_preload_link( OD_Link_Collection $link_collection, OD_URL_Metric_Group $group, string $url ): void { $link_collection->add_link( array( 'rel' => 'preload',