@@ -81,6 +81,11 @@ class TwigPreprocessor
8181 */
8282 private $ fallbackImages ;
8383
84+ /**
85+ * bool
86+ */
87+ private $ disableSocialSharing ;
88+
8489 /**
8590 * TwigPreprocessor constructor.
8691 * @param \Twig_Environment $twig
@@ -95,7 +100,8 @@ public function __construct(
95100 TranslateTerm $ translateTerm ,
96101 TranslatorInterface $ translator ,
97102 CuratorenClient $ curatorenClient ,
98- UitpasClient $ uitpasClient
103+ UitpasClient $ uitpasClient ,
104+ bool $ disableSocialSharing
99105 ) {
100106 $ this ->twig = $ twig ;
101107 $ this ->request = $ requestStack ->getCurrentRequest ();
@@ -106,6 +112,7 @@ public function __construct(
106112 $ this ->translator = $ translator ;
107113 $ this ->curatorenClient = $ curatorenClient ;
108114 $ this ->uitpasClient = $ uitpasClient ;
115+ $ this ->disableSocialSharing = $ disableSocialSharing ;
109116 $ this ->fallbackImages = [];
110117 }
111118
@@ -341,6 +348,7 @@ public function preprocessEventDetail(Event $event, string $langcode, array $set
341348 $ variables ['language_switcher ' ][$ langcodeItem ] = '<a href=" ' . $ url ->__toString () . '"> ' . strtoupper ($ langcodeItem ) . '</a> ' ;
342349 }
343350
351+ $ variables ['show_share_links ' ] = $ this ->disableSocialSharing ? false : $ settings ['share_buttons ' ];
344352 // Share links
345353 $ shareUrl = Url::factory ($ this ->socialHost . '/event/ ' . $ event ->getCdbid ());
346354 $ shareQuery = $ shareUrl ->getQuery ();
@@ -350,7 +358,7 @@ public function preprocessEventDetail(Event $event, string $langcode, array $set
350358
351359 $ variables ['share_links ' ] = [
352360 'facebook ' => 'https://www.facebook.com/sharer/sharer.php?u= ' . urlencode ($ shareUrl ->__toString ()),
353- 'twitter ' => 'https://twitter.com/intent/tweet?text= ' . urlencode ($ shareUrl ->__toString ()),
361+ 'twitter ' => 'https://twitter.com/intent/tweet?text= ' . urlencode ($ shareUrl ->__toString ()),
354362 ];
355363 }
356364
0 commit comments