From 8fe703b471ce6c5d6d248e9724cdcf3dc95aa637 Mon Sep 17 00:00:00 2001
From: Justin Foell <630830+jrfoell@users.noreply.github.com>
Date: Fri, 26 Jun 2020 14:18:12 -0500
Subject: [PATCH] Add optional title param to image tag
---
src/WPStrava/StaticMap.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/WPStrava/StaticMap.php b/src/WPStrava/StaticMap.php
index bd3b441..3c12850 100644
--- a/src/WPStrava/StaticMap.php
+++ b/src/WPStrava/StaticMap.php
@@ -13,9 +13,10 @@ class WPStrava_StaticMap {
* @param int $height Height of map in pixels.
* @param int $width Width of map in pixels.
* @param bool $markers Display start and finish markers.
+ * @param string $title Title attribute to accompany image (default empty).
* @return string HTML img tag with static map image.
*/
- public static function get_image_tag( $activity, $height = 320, $width = 480, $markers = false, $link = true ) {
+ public static function get_image_tag( $activity, $height = 320, $width = 480, $markers = false, $title = '' ) {
$key = WPStrava::get_instance()->settings->gmaps_key;
// Short circuit if missing key or activity object doesn't have the data we need.
@@ -42,7 +43,8 @@ class WPStrava_StaticMap {
$url .= $markers;
}
- return "
";
+ $title_attr = $title ? " title='" . esc_attr( $title ) . "'" : '';
+ return "
";
}
/**