@@ -208,8 +208,8 @@ class SocialsManager
208208 'copy_to_clipboard ' => [
209209 'name ' => 'Clipboard To Copy ' ,
210210 'key ' => 'copy_to_clipboard ' ,
211- 'sharer_url ' => '{{ url }} ' ,
212- 'placeholders ' => [' url ' ],
211+ 'sharer_url ' => '' ,
212+ 'placeholders ' => [],
213213 'html ' => [
214214 'attributes ' => [
215215 'data-copy-to-clipboard-target ' => 'clipboard-page-link ' ,
@@ -269,6 +269,7 @@ public function getSharableSocials(array $registeredSocials): array
269269 return array_map (
270270 function (array $ social ): object {
271271 $ social = $ this ->setSharerUrl ($ social );
272+ $ social = $ this ->setSharableOnClicks ($ social );
272273 $ social = $ this ->setIconFullName ($ social );
273274 return (object ) array_intersect_key ($ social , array_flip ($ this ->allowedSocialItemKeys ));
274275 },
@@ -311,6 +312,17 @@ private function setHtmlClass(array $social): array
311312 return $ social ;
312313 }
313314
315+ private function setSharableOnClicks (array $ social ): array
316+ {
317+ //phpcs:ignore Generic.Files.LineLength.TooLong
318+ if (empty ($ social ['placeholders ' ]) || !in_array ('url ' , $ social ['placeholders ' ], true ) || empty ($ social ['url ' ])) {
319+ return $ social ;
320+ }
321+ $ social ['html ' ]['attributes ' ]['onclick ' ] = "window.open(' {$ social ['url ' ]}', '_blank'); " ;
322+
323+ return $ social ;
324+ }
325+
314326 private function setIconFullName (array $ social ): array
315327 {
316328 if (empty ($ social ['social_icon_name ' ]) || empty ($ social ['social_icon_style ' ])) {
0 commit comments